MCPcopy Create free account
hub / github.com/FlaxEngine/FlaxEngine / InitMemory

Method InitMemory

Source/Engine/AI/BehaviorKnowledge.cpp:146–165  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

144}
145
146void BehaviorKnowledge::InitMemory(BehaviorTree* tree)
147{
148 PROFILE_MEM(AI);
149 if (Tree)
150 FreeMemory();
151 if (!tree)
152 return;
153 Tree = tree;
154 Blackboard = Variant::NewValue(tree->Graph.Root->BlackboardType);
155 RelevantNodes.Resize(tree->Graph.NodesCount, false);
156 RelevantNodes.SetAll(false);
157 if (!Memory && tree->Graph.NodesStatesSize)
158 {
159 Memory = Allocator::Allocate(tree->Graph.NodesStatesSize);
160#if !BUILD_RELEASE
161 // Clear memory to make it easier to spot missing data issues (eg. zero GCHandle in C# BT node due to missing state init)
162 Platform::MemoryClear(Memory, tree->Graph.NodesStatesSize);
163#endif
164 }
165}
166
167void BehaviorKnowledge::FreeMemory()
168{

Callers 1

StartLogicMethod · 0.80

Calls 3

MemoryClearFunction · 0.85
ResizeMethod · 0.45
SetAllMethod · 0.45

Tested by

no test coverage detected