destroy child actor event

Does anyone know why the event destroy doesn’t work?
image



image
Before I put a print string to the event and it does do that but it doesn’t destroy that

  • how many actor instances are there in the scene:

image

  • do you get prints in both places:

it doesn’t destroy that

How do you know these components are not being destroyed? Serious question.

You did not answer the questions and I don’t know how to interpret the video; but, you cannot use Get Actor of Class to find a specific actor instance - it will never work if you have more than 1. It fetches the 1st one it can find, not the one you want - it cannot read your mind.


I believe I see a 2nd Pallet there. So this will not work correctly. You must explicitly declare which actor instance you mean. You might treat the Get Actor of Class as Fetch Me a Random Actor. In this very case, perhaps you want the pallet that the player is either looking at (trace) or gets close to (overlap). That’s one way to determine the correct actor whose components we want to destroy.

I’d question why you need to work with Child Actor Components, though. I’ll assume you’re trying to create slots we place the boxes on, is that correct?

yes
image
and when he puts the 2 boxes in, it transforms into a static mesh and destroys the 2 boxes that were there.

If you’re after something straighforward, use those trigger boxes and give them a tag. Line trace → query tag / modify tag. This way you’ll know if trigger box is taken or not. As suggested in the other thread of yours:

• add a isOccupied boolean variable to the box delivery
• when you attempt to drop, query this variable
• if true => do not drop
• if false => drop, set isOccupied true
• if you ever pick up a correctly dropped box again, set isOccupied false

Instead of the isOccupy flag, use a tag to simplify it. There’s no need to complicate things with destroying components. Especially if you want to pick up those boxes again.


However, if this is going to get complex, I’d look into component inheritance and incorporate the logic into the slot component itself.

The boxes placed here cannot be picked up again, the boxes here are used to create a new mesh that can be picked up with a vehicle


The boxes placed here cannot be picked up again, the boxes here are used to create a new mesh that can be picked up with a vehicle, that’s why I want to eliminate the boxes or make them invisible so that they don’t stay there floating

Not sure I follow, wasn’t it already working correctly in the previous thread? Anyway, ensure you’re interacting with the correct pallet - this is the main issue here. Give the player an overlap volume => Begin Overlap, get Actor pin - that’s your pallet. Either cast or use an interface to send the message that destroys the requested components.

You said you want to replace a mesh. I still do not understand what Child Actors Components have to do with any of this? Nowhere in your script (that we can see) are you instantiating their actors.


Alternatively, if the trigger boxes (or CACs) belong to the pallet, you can Get Owner to get the pallet actor those components belong to.

Yes, what we did before works perfectly, in fact where we left the box is what we did but when we put it inside the new actor it becomes a child actor and does not allow it to be destroyed

As above, you are, most likely, communicating with the wrong pallet. Think about it, when you Get Actor of Class - how do you know which pallet you’re getting?

What you said makes sense but why does the static mesh work and why does it destroy the arrow but not the other thing?
image

I tested this:

And destroying Child Actor Components does indeed destroy them, and also destroys their Child Actors. Not sure what you’re doing differently. If the arrow belonging to the trigger box is gone, then it’s working correctly. :person_shrugging: Something else spawns additional actors / components we cannot see here in the script.


If you want me to have a look, zip the project:

Upload it to Google Drive (or some other public space), and drop the link here or via a private message.

First of all, the Child Actors Component do get destroyed correctly, note they only contain the slot actors - destroying them does not destroy the attached boxes, though:

They will stay even if you replace pallet mesh with a merged variant and destroy the CACs. If you want to continue this way, destroy the actual attached boxes as well:

The entire script triggered by the Completed pin should be inside the pallet actor.


Side note: you must sort referencing throughout the script, you’re approaching a point of no return. If you ever feel you must use Get Actor of Class to find an actor, you’re approaching it incorrectly.

Consider a BP communication guide:

Also, try to wrap behaviours in functions, it will clear up the script, and add comments - the tomorrow you will thank you.

Good luck!

1 Like

It works, you are incredible, by the way, after having done the outline it is harder for me to pick up the box, could it be because I have 2 line traces?

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.