One Logo Pool Ball
RealityFoundation · IOS API REFERENCE

BehaviorTreeResource

class · iOS 27.0+ · SDK 27.1

class BehaviorTreeResource

An immutable representation of a behavior tree. A `BehaviorTreeResource` can be produced by compiling a tree definition. Once compiled, assign it to an entity via ``BehaviorTreeComponent`` to begin driving behaviors: let treeResource1 = try BehaviorTreeResource(definition: Data(behaviorTreeDefinition1.utf8)) let treeResource2 = try BehaviorTreeResource(definition: Data(behaviorTreeDefinition2.utf8)) let treeResources: [String : BehaviorTreeResource] = ["tree1" : treeResource1, "tree2" : treeResource2] entity.components.set(BehaviorTreeComponent(behaviorTree: resource, availableBehaviorTrees: treeResources)) ## Parameters The tree exposes a set of named parameters that control its behavior at runtime, such as movement speed. Read the available parameters via ``parameterNames``. To set values at runtime, use the entity's parameter binding: entity.parameters["MoveSpeed"] = BindableValue(Float(1.0))

Members (3)

init · iOS 27.0+

init

TypeScript
static init(definition: ArrayBuffer): BehaviorTreeResource
Swift declaration
convenience init(definition: Data) throws

Compile a new resource from data, throws on failure.

get · iOS 27.0+

parameterNames

TypeScript
get parameterNames(): Array<string>
Swift declaration
var parameterNames: [String] { get }

Returns the names of all parameters in the behavior tree resource.

static · iOS 27.0+

validate

TypeScript
static validate(definition: ArrayBuffer): Array<string>
Swift declaration
static func validate(definition: Data) -> [String]

Run the compiler and return all tree errors without producing a resource.

Skipped declarations

No declarations were skipped in this snapshot.

All RealityFoundation types →