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"

Office Holiday

Epic Games' offices will be on holiday from June 22nd to July 7th. During this period support will be limited. Our offices will reopen on Monday, July 8th. 

Run function (Event) from Child Actor

Hi guys, I have a blueprint that has a child actor and that child actor blueprint has a custom event. I'm trying to call the child actor event from the main blueprint but the event doesn't show up - the only way I managed to make it work as to Get Child Actor, than to Cast it and only then it would show the custom events.

I don't understand why I needed to get the child actor and then do the casting when the class was already set in for the child actor?

alt text

alt text

Product Version: Not Selected
Tags:
child_actor_1.png (34.1 kB)
chid_actor_2.png (41.5 kB)
more ▼

asked Aug 09 '14 at 01:15 PM in Blueprint Scripting

avatar image

AdrianLazar
33 8 11 14

avatar image AdrianLazar Aug 09 '14 at 01:16 PM

Due to the 2 images limitation I'm posting here what I had to do to make it work alt text

child_actor_3.png (50.3 kB)
(comments are locked)
10|2000 characters needed characters left
Viewable by all users

2 answers: sort voted first

This could just be me speculating, but your UI_InGame_Action is a ChildActorComponent. You need to get the Actor from that component, which is the child actor. The reason I believe you have to cast is as follows. You have gotten the actor. Though the actor in this case has your UI_InGame_Action Class, it's still an Actor Class, which the compiler can't see what that specific children that actor has under normal circumstances. To get by this, you have to confirm with the code, or in this case the blueprint, that it does have said class as a child, and thus allow it to access those functions.

NOTE: If this is the case, doing this to an actor that doesn't have that class as a child will still be able to "access" those variables and fuctions, which results in an ERROR. This is just me relating this situation to how classes and pointers work in C++. This may not be the reason why, but it seams to fit.

In short, when you get the actor, you are not getting the class you give it off the bat, you have to get the actual actor, then cast to tell it IT DOES have that classes components to access them.

more ▼

answered Sep 08 '14 at 06:23 PM

avatar image

ChaoticNemisis
26 1 1 3

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

Bro that´s how you are supposed to do it. that's not an error. Imagine you have 50 instances of the actor with the event attached to the parent and you want to run that event in only 1 of them or in 20 of them ?. Those events are specific for the actor instance. imagine something like an Begin Overlap, Each actor has his own Begin Overlap event that get's triggered for that specific actor when something overlaps. It would be a mess if when Begin Overlap would trigger every single Begin Overlap event that it finds. Just the same with any other event.

more ▼

answered Jan 23 '15 at 07:54 AM

avatar image

Emingo
26 1 2 2

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
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