Difference between revisions of "Suggestions"
(Created page with "Category:Commands For many types, there are named suggestions that can be used in combination with autocomplete to make entering parameters easier. For example, when enter...") |
(No difference)
|
Revision as of 17:10, 30 August 2017
For many types, there are named suggestions that can be used in combination with autocomplete to make entering parameters easier. For example, when entering Component or MonoBehaviour parameters, the console will find all the instances in the scene and allow you to reference them by name. Similarly Enum parameters will display all the names and numeric values for that type.
There are 2 basic sources for suggestions: static members and custom TypeHandlers
Static Members If a parameter has type T and the declaration of T has static member fields or properties of type T, then these will be presented as suggestions for autocomplete.
For example, the UnityEngine.Color struct has some default colores defined in code, i.e:
struct Color { static Color red { get } static Color blue { get } // etc.... }
Any time a color is used as a parameter type in a console command, all of the default colors will be available. The same is also true of Vector2 and Vector3 types: values such as up, down, left, etc. are automatically available
custom TypeHandlers TypeHandlers are effectively a class that defines how suggestions and string conversion should be handled for specific parameter types. More information can be found under TypeHandlers.