Scene Attributes


#1

Hi Guys
I want to do the following : when the user clicks on a certain spot I want to switch to a new scene - however the “old” send shoul hand over some attributes to the new scene.
How would that be done ? Or is this generally achived in a different way ?


#2

I personally did not check, but the forum has already raised a similar question. Try to do as described here: Keep same score variable in all scenes


#3

that should perfectly work - thanks a lot. although I hoped there was a more “object oriented way” :slight_smile:


#4

There are a few ways. One is the classic of having a global JS object/variable to store the values.
As shown in the thread linked above.

You could also create a scene loading manager/script that not only handles the scene loads/unloads but can also pass data between scenes.

It depends on how these scenes are intended to be used. Should they be able to work independently? Or is one very dependent on the other?


#5

Thanks - I guess a scene loader would then be the cleanest way to go.
I intend to do some overview->details relationship.
So you pick one object from an overview ‘map’ and the next scene should show this object in details - so I want to pass this object.
However I will have different ObjectTypes and thus different scenesTypes that need to be instanciated - depending on what objectType the user clicked on


#6

In our Unity project we have a similar problem and use a global scene manager to handle this. It’s basically a global with a nice wrapper but it does allow us to load each scene independently and ‘inject’ known data for testing the scene in isolation/very debug commands etc


#7

Makes sense. sounds like the way i should go. thanks