Spawn Child Actor Component with Bool
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!
asked Mar 15 '19 at 10:35 AM in Blueprint Scripting
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.
answered Mar 17 '19 at 09:08 PM
Nebula Games Inc
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.
answered Mar 17 '19 at 05:33 AM
Follow this question
Once you sign in you will be able to subscribe for any updates here