First off! This has been a lot of fun and this is my first real stumbling block
I have ran into an issue when I run back into a portal where the variable spawnPoint of Portal has not been assigned . You probably need to assign it in the inspector blah blah…
It is assigned in the inspector. I have tried deleting, reverting, reapplying prefabs and it only happens when I try to go backwards in the scene 1 to 0.
Thanks for the response. The portal seems to work in Scene 0, but scene 1 is a different story. The spawn point is set in the inspector. I am at a loss of what the issue is since the console is not offering any good suggestions.
The spawn point is definitely assigned in Scene 1, but that means that when you transition from scene 0 to scene 1, a spawn point is found and the transition works…
If the error is popping up when you transition to scene 0, then the missing reference is in the portal in scene 0.
I was able to recreate the bug. If I start on scene 1 (not 0) the issue happens, but if I start gameplay on scene 0 then I have no issue. Is this something to do with the for each loop?
A couple things to check, just to make sure we’re not missing anything… In the little search box above the line “Sandbox” in scene one, type Portal. Everything should gray out and you should only see one Portal in the inspector.
If you find an extra portal, delete it, and try everything again. In a later lecture we’ll deal with multiple portals (using an identifier) but we’re not using those quite yet.
If not, then something else is going on. Post your Portal.cs script, and don’t forget to format it using the </> button at the top of the reply box.
Hmm. I’ll need to take a closer look.
Zip up your project and upload it to https://gdev.tv/projectupload Don’t forget to remove the Library folder to save space.
That one was a little harder to debug than I thought it would be.
I could tell that the portal script was picking up a portal other than the one in the scene, which was extremely odd, so I added a Debug in GetOtherPortal()
Debug.Log($"found portal {portal.name}");
The result I got was unexpected, it sad “Found Portal saving”
As it turns out, in your PersistentObjectPrefab, in the saving object there is a Portal component. Remove this and you should be good to go.