Skip to content

Error Checks

Actions provide some utility methods to help check for valid setup while editing.

CheckParameters

The CheckParameters method can be used to check that required parameters are assigned.

public bool CheckParameters(params object[] parameters)

For example, use it in CanExecute to check required fields:

[WriteOnly]
[Tooltip("The integer to add to.")]
public IntegerRef Integer;

[Tooltip("The value to add.")]
public IntegerVar Add;

public override bool CanExecute() => CheckParameters(Integer, Add);

Optional Fields

Do not check optional fields - they are allowed to be unassigned.

ErrorCheck

Override the ErrorCheck method to perform arbitrary setup checks.

Return an error string that describes the error or null if no errors are found.

public virtual string ErrorCheck()