Apologies for the novice question. I feel like I’m missing something fundamental here.
So I have an actor with a static mesh component I want to be able to modify per instance in the editor view. However, when I begin play I want said mesh to despawn. Then I want to send it a spawn message, and have said mesh reappear.
I’ve gotten the spawn logic to work when all the meshes/actors are the same, or otherwise be imprecise (I.E. spawn an unrelated static mesh) but I really need each of these instances to spawn their own bespoke mesh and have that mesh exist in the editor view.
This will allow you to place actors in the scene and assign each a unique mesh:
Circling back to the very first pic: instead of destroying the component on Begin Play, either set the mesh to none or hide it instead. When interaction (spawn) happens, assign the Static Mesh Component a New Mesh asset using the abovementioned variable.
Alternatively, there is a special property for cases like this:
The Static Mesh Component is Visible while we work in the editor, but Hidden when the game is running. In which case you can assign the meshes to the actors in the scene as you see fit and then the only script you’d need would be:
for the goofy hack. Thankfully this is not needed here but there are instances where that kind of out of the box thinking is the only way forward, be it due to bugs or engine / BP limitations.
Thank you! Exactly the kind of fundamental info I was looking for.
Although, it would appear setting the mesh to “Hidden in game” makes it unable to be toggled/made visible when “spawned”. I had to uncheck that and toggle it on play instead:
Visibility and Hidden are different properties and different nodes - check my screenshot again. Once the Hidden is False, you can use Visibility. Or use just Hidden: