Not loading the second scene

Hello,
I’m having trouble loading the second scene going through the portal in de first scene, even when I don’t have any save file.

Portal.cs :

private IEnumerator Transition()
{
if (sceneToLoad < 0)
{
Debug.LogError(“Scene to load not set.”);
yield break;
}
DontDestroyOnLoad(gameObject);
Fader fader = FindObjectOfType();
SavingWrapper savingWrapper = FindObjectOfType();

        yield return fader.FadeOut(fadeOutTime);
        savingWrapper.Save();
        yield return SceneManager.LoadSceneAsync(sceneToLoad);
        savingWrapper.Load();

        Portal otherPortal = GetOtherPortal();
        UpdatePlayer(otherPortal);

        savingWrapper.Save();

        yield return new WaitForSeconds(fadeWaitTime);
        yield return fader.FadeIn(fadeInTime);

        Destroy(gameObject);
    }

It seems your portals are not on the root level. As the message states (and Sam said it, too), the DDoL only works on root-level objects. A portal cannot be nested within another game object.

With that being said, we have had discussion on this forum regarding this. I don’t like my portals just lying around everywhere in the hierarchy and wrote a big (pointless) bunch of code that allowed me to put it where I wanted it and still got it to work. @Brian_Trotter came around and made a comment that just made it so simple. See this post: Non Root-Level Portals

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

Privacy & Terms