Suggestions

From ReflexCLI
Revision as of 06:31, 3 September 2017 by Rtm223 (talk | contribs) (Custom Type Handlers)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

For many types, there are named suggestions that can be used in combination with the autocomplete feature to make entering parameters easier.

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.