Transparency Coroutine Error

If we try to load into a new Scene while we still are in the transparency Coroutine of the canopy or trees, it will fire an error, cause the gameobject that the coroutine tries to access is inactive. How do we work around this?

This is easily replicatable by putting canopy over the scene exit / entrance and then exitting the area while under the canopy

This is a known bug. It shouldn’t actually affect anything, but there is a bit you could add to the Transparency script:

void OnDisable()
{
    StopAllCoroutines();
}
1 Like

Try using methods to activate and deactivate objects in the scene. Instead of keeping the canopy or trees active throughout the loading of a new scene, you can deactivate them before loading a new scene, and then reactivate them after loading is complete.

The canopy will actually deactivate itself, but the Coroutine will still fire one last huzzah, and the GameObject the routine is on will be gone.

2 Likes

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

Privacy & Terms