i5-Toolkit-for-Unity
i5-Toolkit-for-Unity copied to clipboard
Scene with name "i5 Persistent Scene" already exists (PersistentScene instead of default DontDestroyOnLoad)
hi guys, first of all, just wanted to let you know i've been playing with the OpenIDConnectService + GoogleOidcProvider + firebase auth and it works very nicely!
now for the issue
Is your feature request related to a problem? Please describe.
I noticed that on scene change, im getting the following errors:
ArgumentException: Scene with name "i5 Persistent Scene" already exists
...
Some objects were not cleaned up when closing the scene. (Did you spawn new GameObjects from OnDestroy?)
The following scene GameObjects were found:
Service Manager Runner
then I started digging in the code and was surprised to see that this toolkit solution for persistency between scenes relies on its own unique solution - "Persistent Scene" (https://rwth-acis.github.io/i5-Toolkit-for-Unity/1.5.0/manual/Utilities/Persistent-Scene.html)
so there's an assumption, that the developers should always use LoadSceneMode.Additive when changing scenes.
in my specific case, the game is already in the default LoadScene implementation + using DontDestroyOnLoad and we would like to keep it this way for now.
Describe the solution you'd like
actually I found a "hack" to make it work with the following line:
DontDestroyOnLoad(ServiceManager.Instance.Runner.gameObject);
but, if it was implemented inside the toolkit with some kind of ServiceManager.DontDestroyOnLoad() or whatever config you feel will be more user-friendly, it would be more nice and less frustrating for developers to realize wdf just happened ( I spent few hours to realize what is going on and solve it... )
Describe alternatives you've considered described above
Additional context described above
thanks, rom