Is there a way inside an actor to keep a reference to another actor?
I thought about using a simple pointer to an actor, ATarget, inside the big, main actor, ACannon, to keep track of ATarget's position.
But it seems that the traditional C++ way of instantiating a ATarget class object with a constructor inside the ACannon constructor isn't the right way to do. When initializing the ATarget in the ACannon's constructor, it failed to do so with the use of ObjectInitializer.
Could anyone give hints on what I should do here instead? Thanks in advance.
asked Apr 03 '15 at 02:10 AM in C++ Programming
Constructor only valid for create component for the class, all the reference actor instance need to be create at runtime. You should put that instantiate in BeginPlay(). If not, you can add a ChildActorComponent in the ACannon, and set class to ATarget.
answered Apr 03 '15 at 02:21 AM
Follow this question
Once you sign in you will be able to subscribe for any updates here