Parameters
Parameter types
All primitive types and basic Unity value types such as Vector3
and Color
are supported out of the box. Also, most types derived from UnityEngine.Object
can be used as parameters.
This means types like GameObject
, ScriptableObject
, MonoBehaviour
can be used as parameters without any setup.
When typing the parameter in the command field, we specify the name of the object we want to reference. The object is then found automatically with the given name.
It's also possible to use prefab game objects as parameters. To do this, we can place a [Prefab]
attribute in front of our parameter. Like so:
Editor commands
When making editor commands, asset types like MonoScript
, StyleSheet
, Shader
etc. can also be used as parameters. The assets are found by name, in the asset database.
Custom types
Custom types are also supported as parameters. See the converters section for more details about custom types.
Optional parameters
Optional parameter values are also supported. You can simply define a method with default optional parameters. Given the example above, if you were to execute the command without any argument, it would default to dealing 1 damage.
Last updated