Ok this should be straightforward. I have a powerup that the player can pick up and it should simply vanish with the possiblity of unhiding it later. The powerup is a blueprint that consists of several components.
What’s the best way of going about this? I’ve tried to hide the root component but then the children remain. I’ve tried to destroy the actor which makes it all vanish but of course instantly cuts off the pickup sound I’ve put in. I can hide all components separately but surely there is a more elegant solution?
Good idea, didn’t work either though. Nothing seems to happen when I use a reference to the powerup blueprint and “Set Actor Hidden in Game” to true.
If it had worked I imagine that all powerups based on that blueprint would have been hidden at the same time though?
At the moment I’m using “GetChildrenComponents” and a “ForEachLoop” node and then do “SetVisibility”. That’s at least a little bit more elegant, but I doubt that’s the proper way to do it.
Just out of curiosity, Gigantoad, how are you playing the sound on the pickup? I have a pickup that I’m calling Destroy Actor on immediately after using Play Sound at Location and using Get Actor Location (Self) and the sound is not cut off. Doesn’t really answer your original question, but that might be a solution if that’s the only issue you have with destroying the actor.
Oh, interesting. I’m using a sound cue as a component of the powerup and then drag that into the blueprint and drag out a node to a “Play” node. Guess play at location might be better.
So I tried this and it works fine, thanks for the tip. The down side of this is that I don’t seem to have much control of the sound at the blueprint level, for example I can’t control the volume with a “Volume Multiplier” node to vary the volume based on some factors happening in the BP. Luckily that’s not necessary in this case.