Casting Actor class to child class derived from it?
I've run into specific issue/a bug. I've created a new C++ class that extends the Actor class and implements the gameplay tags interface as in this tutorial (http://shootertutorial.com/2016/09/20/using-gameplaytags/). The class is called TaggedActor.
I've found however that I can't use the actor class returned from most functions (like GetOverlappingActors) with my TaggedActor, which is fine, however I can't for the life of me figure out how to convert an actor to a tagged actor. I understand that you can't cast parents to children due to missing functionality but I can't even seem to find how to create a child, plug in all parent values from it and fill in the gaps myself.
Moreover, I have a loop that uses an array of tagged actors that I need to add objects from an array returned by GetOverlappingActors which does some checks and (when it works) adds them to an array of TaggedActors called _actorsInSight. The problem here is that I can't add the current loop object to the actors in sight array due to it expecting a taggedActor reference and not an actor reference, however, if I change the type of the _actorsInSight array to actor, plug it in everywhere where necessary then change the type back to taggedActor (without it unplugging itself) it magically compiles and everything works. When I restart unreal however, it breaks the links and complains it's incompatible again.
An image might help to illustrate my problem:
The main question though, is as in the title as it would cause me to avoid this problem altogether.
asked May 17 '17 at 09:43 AM in Blueprint Scripting
Follow this question
Once you sign in you will be able to subscribe for any updates here