☑ How to know the scene running id

Hello, is there any way to know what scene is running? I mean something like
Var scene=app.root.sceneid;

You could do:

var sceneRoot = this.app.root.findByName("SceneRootNodeName");
if (sceneRoot && sceneRoot.enabled) {
    // SceneRootNodeName is within application
    // and is enabled
1 Like

Seems it wont solve my problem, i decided to merge the scenes and just delete the entities i don’t need, scenes the way they are now are good just to some purpose like menu/game or games with stages, but since all variables are restored when the scene change is not suitable if i need to keep the count of player lives
if i understand how it works is
project (no files in this can be added)
scene1 (files of the scene root etc etc)
scene2 (files of 2nd scene root etc etc)
so i can’t have variables in project used by all scenes am i right?

If you have script attached to entity, that you then remove, than all data associated with that entity will be gone.

If you have two scenes, and both of them got Camera entity with own Camera script on them, those are different entities, and they are unrelated to each other. Means if you do want to preserve that entity to other scene, you need or reparenting it, or not delete it, and have no camera in other scene.

Same applies to any other scripts in your scenes.

I have the Root entity in both scenes so the script there will be different also if i don’t delete them is that right? But if i have just 1 Player and don’t delete it the script in that entity will be kept with the current values is that right?

Experimentation on simple new project to test it out - is great way to prove or deny those assumptions.
I will let you test it :slight_smile:

Lol ok means something will work so i will find out thanks a lot :slight_smile:

1 Like

Ahah it’s amusing, now i have again the error for the animation coz i don’t delete the player entity. God has a great sense of humor. Ok will change again, hoping that no more errors pop up