Difference between revisions of "Suggestions"
(→Custom Type Handlers) |
|||
Line 24: | Line 24: | ||
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 <code>Vector2</code> and <code>Vector3</code> types: values such as <code>up</code>, <code>down</code>, <code>left</code>, etc. are automatically available | 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 <code>Vector2</code> and <code>Vector3</code> types: values such as <code>up</code>, <code>down</code>, <code>left</code>, etc. are automatically available | ||
− | ===Custom | + | ===Custom Parameter Processor=== |
− | Type Handlers are a class that defines how suggestions and string conversion should be handled for specific parameter types. More information can be found under [[ | + | Type Handlers are a class that defines how suggestions and string conversion should be handled for specific parameter types. More information can be found under [[Parameter Processors]]. |
Latest revision as of 06:31, 3 September 2017
For many types, there are named suggestions that can be used in combination with the autocomplete feature to make entering parameters easier.
Contents
Examples of Suggestions
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.
Suggestion Sources
There are 2 basic sources for suggestions: static members and custom type handlers
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 colors 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 Parameter Processor
Type Handlers are a class that defines how suggestions and string conversion should be handled for specific parameter types. More information can be found under Parameter Processors.