O'Reilly logo

Mastering Unity Scripting by Alan Thorn

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

C# attributes and reflection

From this point forward in the chapter, all editor extensions will rely heavily on the concepts of attributes and reflection. These concepts are not specific to Unity but refer to more general ideas in computer science, programming, and to their application in languages such as C# as well as in the .NET framework. Before proceeding to the next editor extension, let's consider attributes and the related concept of reflection using the example of the Range attribute, which is native to Unity. Consider the following line of code:

public float MyNumber = 0;

This public variable will be displayed in the Object Inspector with an edit field that allows the user to type in any valid floating point number thereby setting the ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required