x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

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:

Image

The main question though, is as in the title as it would cause me to avoid this problem altogether.

Product Version: UE 4.15
Tags:
more ▼

asked May 17 '17 at 09:43 AM in Blueprint Scripting

avatar image

errur
1

(comments are locked)
10|2000 characters needed characters left

0 answers: sort voted first
Be the first one to answer this question
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question