Hello,
After implementing the steps taken on the “Avoiding The Singleton Pattern”, I noticed a new behaviour in my game:
When using a portal from scene A to scene B, all is well. However, when moving back to scene A, i get the following:
MissingReferenceException: The object of type ‘CanvasGroup’ has been destroyed but you are still trying to access it.
Your script should either check if it is null or you should not destroy the object.
RPG.SceneManagement.Fader+d__3.MoveNext () (at Assets/Game/Scripts/SceneManagement/Fader.cs:33)
UnityEngine.SetupCoroutine.InvokeMoveNext (System.Collections.IEnumerator enumerator, System.IntPtr returnValueAddress) (at <42a5878ce129403083acccf18e43363f>:0)
Furthermore, when persisting and hopping between levels, after the second or third change, the player gets randomly teleported to new spot that seems unrelated to anything else… just somewhere in the rough middle of the world.
It’s always the second scene switch, no matter if you go A-B-A or B-A-B.
I double-checked the Code and everything is correctly implemented - code is exactly the same as the instructor’s git, except the agent navmesh change to warp, which was described in an earlier lesson.
The PersistentObject, with the Fader in it, is assigned to the Core’s Persistent Object Prefab field and the fade works well when fading out and starting to lead to the second scene.
Oh, and currently using Unity 2020.3.0f1
I think I’m too green to understand what went wrong. Anyone else had the same issue?