Class Behavior
Behavior instance script that runs Behavior Tree execution.
Namespace: FlaxEngine
Assembly: FlaxEngine.CSharp.dll
Syntax
[Category("Flax Engine")]
[Unmanaged]
public class Behavior : Script, ISerializable
Constructors
Behavior()
Properties
AutoStart
If checked, auto starts the logic on begin play.
Declaration
[EditorOrder(10)]
[Unmanaged]
public bool AutoStart { get; set; }
Property Value
|
System.Boolean
|
Knowledge
Gets the current behavior knowledge instance. Empty if not started.
Declaration
[Unmanaged]
public BehaviorKnowledge Knowledge { get; }
Property Value
|
BehaviorKnowledge
|
Result
Gets the last behavior tree execution result.
Declaration
[Unmanaged]
public BehaviorUpdateResult Result { get; }
Property Value
|
BehaviorUpdateResult
|
System
The system for behaviors update.
Declaration
[Unmanaged]
public static TaskGraphSystem System { get; }
Property Value
|
TaskGraphSystem
|
Tree
Behavior Tree asset to use for logic execution.
Declaration
[EditorOrder(0)]
[Unmanaged]
public BehaviorTree Tree { get; set; }
Property Value
|
BehaviorTree
|
UpdateRateScale
The behavior logic update rate scale (multiplies the UpdateFPS defined in Behavior Tree root node). Can be used to improve performance via LOD to reduce updates frequency (eg. by 0.5) for behaviors far from player.
Declaration
[EditorOrder(20)]
[Limit(0F, 10F, 0.01F)]
[Unmanaged]
public float UpdateRateScale { get; set; }
Property Value
|
System.Single
|
Methods
ResetLogic()
Resets the behavior logic by clearing knowledge (clears blackboard and removes goals) and resetting execution state (goes back to root).
Declaration
[Unmanaged]
public void ResetLogic()
StartLogic()
Starts the logic.
Declaration
[Unmanaged]
public void StartLogic()
StopLogic(BehaviorUpdateResult)
Stops the logic.
Declaration
[Unmanaged]
public void StopLogic(BehaviorUpdateResult result)
Parameters
|
BehaviorUpdateResult
result
The logic result. |
Events
Finished
Event called when behavior tree execution ends with a result.
Declaration
[Unmanaged]
public event Action Finished
Event Type
|
System.Action
|