Best way to store actor reference(s) in variable(s) in level blueprint?
How can I store a Static Mesh Actor reference in a (public) variable in my Level Blueprint?
Without initializing them myself this way:
Because I can't set the default value of a Static Mesh Actor variable in the Blueprint Editor:
Or if I seem to go the wrong way about this, what would be a better way get these 8 Static Mesh Actor (that are already placed in a level in the editor) as references in variables? I want to have specific references to each of the 8 objects, not as a group, so I can hide/show them individually with my own function?
I think I was going about it the wrong way, in the Level Blueprint you don't need to store Static Mesh Actors in variables that already placed in the level. Every time you require a reference you simply select the Actor in the viewport, right-click in the Level Blueprint and click on Create a Reference to "YourActorName". For example:
In other cases you would need to assign references to variables, for example if you are spawning Actors with blueprints.
This might not be the most code efficient way, but you could assign actor tags to your static mesh actors in the level and then in your blueprints iterate through GetAllActorsWithTag. No storing of variables needed, only that you'll need to call that function each time you want to do some logic with those actors.
answered May 19 '17 at 02:37 PM
Follow this question
Once you sign in you will be able to subscribe for any updates here