I think I should be more clear... mystaticmeshtohide would be the actor holding the static mesh and to unhide it you would respawn the actor in a way to conserve space. Although just setting a staticmesh property to none inside the staticmeshcomponent should do the trick but I haven't really tried it.
1. You need to get the reference to the actor you want to show / hide
2. Instead of spawning / destroying it, I would set the actor's bHidden Value to false, to hide, and to true to reshow it. As far as I know, Show/hide and Spawn/Destroy may both have the same effect. Although I imagine Spawn/destroy would have more overhead cost, but that's a guess.
Thanks for your input but
How do I get the reference to a static mesh (lets say a wall with browser name of StaticMesh'LT_Buildings2.SM.Mesh.S_LT_Buildings_SM _BunkerWallA_STR') that was placed in the Unreal Editor ?
The idea is this for a top-down game - where the player can hide/show above levels by pressing a UI button. So if the player is on level 1, pressing the hide/show will unhide the level overlay above.
To get a reference I know of a couple ways, and likely not all.
Trace: you trace from somewhere to somewhere else. It will return the first actor it hits. i.e. ActorReferance = Trace(...);
TraceActors: Like trace, but it will only return a specific type of actor, and skip actors not of the desired class.
foreach WorldInfo.AllActors(class'desiredClass', ActorRef) : This will iterate through all actors in the level. This is not really ideal as it is the slowest.
Touching Actors: Growing Sphere of detection that returns all instances of desired class.
*My knee jerk thought for this:
1. Create a new class extended from static mesh actor. Give it a new var() int; that will basically be what tier of overlay it is.
When ever you put in a static mesh to your level, do it from this new class, set the overlay tier # on it.
2. In the postbeginplay() of wherever this exec function to show/hide overlays is, do an
Have this iterator sort the different tiers of static mesh into different dynamic arrays, which should likely be global. One for each overlay tier.
3. In the show/hide functions, iterate through the correct array(s), setting bhide=true or false, according to your needs.
*not going to work for skeletal / animated models, would need a separate class and a second set of iterators
The plan is to do the big slow run only once, and then have arrays containing only the needed information to go through.