Version: Unity 6.7 Beta (6000.7)
LanguageEnglish
  • C#

State.OnDefineOptions

Suggest a change

Success!

Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.

Close

Submission failed

For some reason your suggested change could not be submitted. Please <a>try again</a> in a few minutes. And thank you for taking the time to help us improve the quality of Unity Documentation.

Close

Cancel

Declaration

protected void OnDefineOptions(IOptionDefinitionContext context);

Parameters

Parameter Description
context Provides methods for defining state options.

Description

Called during State.DefineState to define the options available on the state.

Override this method to add options using the provided IOptionDefinitionContext. The options of a state only appear in the graph inspector when the state is selected: they are never drawn on the state in the state machine view.

 protected override void OnDefineOptions(IOptionDefinitionContext context)
 {
     context.AddOption<float>("speed")
         .WithDisplayName("Speed")
         .WithTooltip("The speed at which the state runs.")
         .WithDefaultValue(1.0f);
 }