I am attaching an image of 2 areas of the blueprint tutorial from the documentation. I have red stars indicating I am in need of an explanation as to why the and how the cast works and what it achieves(as I have shown with red stars in documentation). Basically also, can someone explain how the casting is working in this image from the behavior tree example. I always thought of casting of treating something “as is something x”, or if a returned value and its the one you want, etc. Honestly this makes me real confused so if someone could explain the casting that would be great:
The logic is “If AI CON REF is not equal NULL then just use AI Move To.” So if AI CON Ref is not set, it casts and stores it once, saving time on repeated executions of the Event, whose Blueprints don’t get cleaned up after execution. It mostly just sounds weird so the execution lines don’t have to cross =)
Functions get cleaned up after execution, so local variables are lost, so we re cast every time the function is called. I’d have to dig back into that part of the project, but I don’t think you can use a non-local variable in there to store the casted Owner Actor (it may have been updated).
I’ll look into it and see if I can unify the logic. At the same time, with Perception being usable, I think it’s time to go back and re-write the Behavior Tree and EQS quick starts to use it.
Yes if you could look into it that would be great. If you decide to re-write the behavior tree and EQS quick start please let us know.