Bug in Avoiding the Singleton Pattern lesson

Hello.
I have read someone else with the same issue but they solved it in another way that wouldn’t work for me. Basically if I walk back to the the previous scene while the current one is still fading in, it would fade out, load the other scene and never fade in.

I think that since the portal waits for the FadeIn IEnumerator to end before destroying itself, then the PersistentGameObject prefab doesn’t get destroyed and thus it conflicts with the another PersistentGameObject that gets automatically Instanced when the other scene loades

There are no error and no warnings when this happens.

The only solution I thought was to disable the player controller script when I load the scene and then enable it only after it has faded in completely

This is exactly the solution, and we cover this in the Final Polish section, in the lectures entitled

Privacy & Terms