Spawn Child Actor Component with Bool

Greetings!

I am making a cabinet with health pickups inside that can be used once the player open it.

To facilitate the production, I want my cabinet to have editable bool to set if the cabinet has a pickup inside and if so, set the location of that item. I am using a child actor component for the pickable.

So far, I managed that part but I struggle to make the item spawn only if I set the bool to true. By default, the item will spawn at the root and I don’t want that. Here’s the construction script so far.

Any clues on how I could make it work?

Thank you for your time!

From the image you posted I don’t see anything stopping the “health pickup” object from being spawned. Right now all that is happening is the object is being set to the “item location” location, if use item is true. You need to have different logic for spawning the health pickup or not.

I don’t really understand this setup. In order to use the construction script as you have it, the health pickup has to already exist as a child actor component. The only thing the boolean is doing is “moving” where the health pick up is located. You should be using a “spawn actor from class” and “attach component” nodes if you want something to be “created” that didn’t exist.

I did as you suggested in the Event graph and it’s working good! Thank you Nebula!