Hi,
I am a unity nab and I can't figure out this strange behaviour i have in my test game while using `dontDestroyOnLoad`.
I have a `__preloadScene` that is my very first scene that gets loaded in the game. It only has to load my `GameSparksManager`script inside an empty `GameObject` that needs to be a singletone that never gets destroyed.
My `GameSparksManager` singletone script is this:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;
public class GameSparksManager : MonoBehaviour {
public static GameSparksManager instance = null;
void Start() {
Debug.Log ("ciao");
SceneManager.LoadScene("Auth Scene", LoadSceneMode.Additive);
}
private void Awake()
{
if(instance == null)
{
instance = this;
DontDestroyOnLoad(this.gameObject);
} else
{
Destroy(this.gameObject);
}
}
}
But what happen is that when you move between scenes the stuff inside them doesn't get destroyed, here an example video:
https://cl.ly/3B3o2X2K0H03
what am i doing wrong? thanks for your help
↧