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. 

Get hit child actor

Hello all, try find information how to get child actor when it hit or overlap. I have actor (master_enemy) and I create child class. I want get chid actor when this actor get hit, how I can do it? alt text

Product Version: UE 4.20
Tags:
child.png (136.6 kB)
more ▼

asked Sep 25 '18 at 04:30 PM in Blueprint Scripting

avatar image

Schepetkov
34 4 4 12

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

1 answer: sort voted first

Cast to the child class instead.

more ▼

answered Sep 25 '18 at 04:49 PM

avatar image

Everynone
14.6k 76 25 61

avatar image Schepetkov Sep 25 '18 at 05:42 PM

how? If I will use 1000 child class?

avatar image mightyenigma Sep 25 '18 at 05:44 PM

If you need to test against something, you can make the 1000 child classes implement a certain BP Interface and Branch on [Implements Interface]. OR you can have an Enum variable in the default settings in the parent class, and then each Child class can have their default of that Enum set to a different value and you can Branch on that without having to Cast to a child class to get it.

avatar image Schepetkov Sep 25 '18 at 05:49 PM

I correctly understand? It is solution for this problem? check all children in class??alt text

untitled.png (142.8 kB)
avatar image mightyenigma Sep 25 '18 at 06:01 PM

No. I mean use an interface, or a parent class variable set to a certain default value on each child class and test against that, instead of testing which child class it is. That way you only need to check one thing and it will work on all child classes.

avatar image Schepetkov Sep 25 '18 at 06:13 PM

Nightyenigma, thank you for support, can you send example? about " or a parent class variable set to a certain default value", can not understand how I should do(

avatar image Everynone Sep 25 '18 at 07:13 PM

As mightyenigma suggested, if you want to have 1000 child classes (why?!), you may need an interface:

https://docs.unrealengine.com/en-us/Engine/Blueprints/UserGuide/Types/Interface

Do note it takes while to wrap one's head around them.


Depending on what you're trying to do as you did not explain what purpose it serves, why not create a function or event in the parent and have the child override it.

avatar image Schepetkov Sep 25 '18 at 07:23 PM

Thank man, I alray test it, work fine!)

avatar image Schepetkov Sep 25 '18 at 07:08 PM

My solution is, but via interface all work too. alt text

untitled.png (43.8 kB)
(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