switch complex objects

The goal is to switch predefined objects that stands on the exactly same position.
More particular it is a supermarket shelf with different arrangements of products.
So I want to switch the arrangements of products inside the shelf. Button 1 is arrangement 1,
button 2 is arrangement 2 and so on.
I tried streamlevels:
first try: each sublevel has a shelf with products arranged, I simply load
and unload the sublevels. All sublevels (shelfes) are at the same position in space, this leads
into light building problems. Some shelfes turns into black.

second try: each sublevel contains the whole room with a specific arrangement of the products, including
lighting and volumes. Then I arranged all sublevels (all rooms) in a line with space.
I set my load/unload network in combination with a relative location node and simply jump into the right room, depending
on which button was clicked. This setup ran into inconsistent lighting of the rooms, so every room looks different and you see the trick.

Then I tried actor blueprints, but I have multiple products and the editing/arrangement inside a blueprint is limited. Also the framerate
goes down because the actors are movable. In the end I have lets say 15 different shelf arrangements, each with hundreds of products.

What is the best way to achieve this?


Thanks a lot

Many ways to go about this.

I’d go with this, a shelf being an actor, it would know all of it’s shelving positions (list of vectors). At the constructor I would place all the static meshes. That would allow me to use instanced static meshes which are faster than spawned static meshes… At runtime you’d have an option to swap items if desired etc.

I wouldn’t use level for this. I’d use the player controller to direct the shelves to populate / swap themselves.


Using the player controller would be a bad idea. Just create the entire shelf as a single actor. Then create a blueprint utility to spawn it with whatever objects you want. Using instanced static meshes would be the correct way to go instead of static meshes.

Hi ZoltanJr,
can you explain a bit more in deep?


If you create your shelf actor then create a function on it to spawn your items. Just enable blutility in your experimental features and mark the function as available in editor. On your function spawn your instanced static meshes just by doing a for loop for however many times you want and then it should populate your shelves. Only annoyance with this is that it will clear itself whenever you try and move the shelf but you could always set it to run on begin play if nothing has been generated just in case.