i wanted to ask about how we using node memory... when we use standard cast?? GetNodeMemory?? GetSpecialNodeMemory?? and i don't know why in some decorator (e.g BTDecorator_Cooldown) we use reinterpret_cast???
asked May 29 '15 at 07:57 AM in C++ Programming
All runtime variables should be placed in NodeMemory block. None of base classes use it (task, decorator, service), so you don't have to worry about allocations from parent class.
Since it's being stored as continuous block of bytes, it's best to use regular C cast or reinterpret. Of course this is potentially dangerous, but usually allocations are limited to single class which makes it easily manageable.
If your node requires complex data types (containers with dynamic allocations) please consider changing it to instanced one: set bCreateNodeInstance in constructor. Those nodes don't use memory block, but can operate on class properties/variables instead.
Special memory block is special, and sole purpose of its existence is hiding internal engine-level mechanics from users. Please don't use it unless you really have to and keep in mind to use proper struct hierarchy, so memory layout stays the same.
answered May 29 '15 at 08:55 AM
Follow this question
Once you sign in you will be able to subscribe for any updates here