Portals will not load next scene

First off I’d like to reference this issue : Portal Transition issues (section 6 : 68-73) As this issue was fixed…

Now I have added in this sections work (save/load stuff) and the portals do not work once again. The fade works but they will not load the next scene. I have added in a 3rd scene and set up the portals so specs, renamed the identifiers in the Enum (to make it easier to understand what one goes to what) and tested a few times with nothing but broken portals.

On the bright side, the save seems to be working.

Anyone able to help here?

Quick video showing what happens : https://youtu.be/TCQkP21HPfQ

@sampattuzzi Following on from your previous advice (If you want me to unlock and merge let me know)

I think we will need more than just a video. How have you tried to debug this already? What does the code look like?

Code is exactly like in the course with the exception of the code snippet you supplied me in my last issue in the portal script.
Here is a link to the latest version of the game if you need it : https://www.dropbox.com/s/5njl68mn38fw820/RPG%20Tutorial.zip?dl=0

Here is the code for Portal.cs if this is all you need :

using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.AI;
using UnityEngine.SceneManagement;

namespace RPG.SceneManagement {
    public class Portal : MonoBehaviour
        enum DestinationIdentifier { Lake, Town, Farm, Obsticles}

        [SerializeField] int sceneToLoad = -1;
        [SerializeField] Transform spawnPoint;
        [SerializeField] DestinationIdentifier destination;
        [SerializeField] float fadeOutTime = 1f;
        [SerializeField] float fadeInTime = 2f;
        [SerializeField] float fadeWaitTime = 0.5f;

        private void OnTriggerEnter(Collider other) {
            if(other.tag == "Player") {

        private IEnumerator Transition() {
            if(sceneToLoad < 0) {
                Debug.LogError("Scene to load is not set");
                yield break;

            Fader fader = FindObjectOfType<Fader>();

            yield return fader.FadeOut(fadeOutTime);

            // Save current level
            SavingWrapper wrapper = FindObjectOfType<SavingWrapper>();

            yield return SceneManager.LoadSceneAsync(sceneToLoad);

            // Load current level

            Portal otherPortal = GetOtherPortal();


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

        private void updatePlayer(Portal otherPortal) {
            GameObject player = GameObject.FindWithTag("Player");
            player.transform.rotation = otherPortal.spawnPoint.rotation;
            // Course code before adjustment by Sam
            //player.transform.position = otherPortal.spawnPoint.position;
            //player.transform.rotation = otherPortal.spawnPoint.rotation;

        private Portal GetOtherPortal() {
            foreach (Portal portal in FindObjectsOfType<Portal>()) {
                if (portal == this) continue;
                if (portal.destination != destination) continue;
                return portal;
            return null;

As stated previously, I’m still rather new to Unity and C#. With that said, I did attempt to debug the issue as best I knew how. Double checked all trigger settings, rolled back to a previous save and did the section again, put a debug snippet in the portal script before and after the altered code (from previous issue). I’d like to think I’m pretty thorough on my end before I ask for help.

Just curious if there was anything else on my end that you need to help resolve my issue? Just let me know.

Solved this one over discord and closing now.
One solution was bugged library files within the project and missing scenes from the build settings.

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

Privacy & Terms