- red arrow - create a variable (right click the
New Mesh
node pin andPromote To Variable
), flag it asInstance Editable
Add the same piece of script to the Construction Script
:
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:
We merely unhide what was hidden. You can destroy it as you already do.
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.