Difference between revisions of "Suggestions"

From ReflexCLI
Jump to: navigation, search
(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...")
 
(Custom Type Handlers)
 
(One intermediate revision by the same user not shown)
Line 1: Line 1:
[[Category:Commands]]
+
[[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 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.
+
For many types, there are named suggestions that can be used in combination with the autocomplete feature to make entering parameters easier.
  
There are 2 basic sources for suggestions: static members and custom TypeHandlers
+
==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.
  
Static Members
+
==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.
 
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:
+
For example, the <code>UnityEngine.Color</code> struct has some default colors defined in code, i.e:
  
 +
<pre>
 
struct Color
 
struct Color
 
{
 
{
Line 15: Line 20:
 
// etc....
 
// etc....
 
}
 
}
 +
</pre>
  
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
+
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 TypeHandlers
+
===Custom Parameter Processor===
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.
+
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.

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.