I am trying to make a website which has to load multiple different scenes. I created an empty game object, attached the scenswitcher script to it and then in the list added the references of my scenes. Then in the buttons I dragged the sceneswitcher game object and referenced the correct int of the scene. However, whenever I export my project it loads my initial first scene (first page) but after a few seconds it loads one of the other scenes without me having pressed the button to and then it stays there and the back button which should take me back to the front page doesn’t do anything. See screenshot of the errors that it is giving me. What can be causing this and how do I fix it? Thanks
Hi Darkia, it sounds like your Sceneswitcher is triggering a scene change automatically—likely from code executing in its Awake or Start methods—rather than waiting for the button click. This can also affect your back button if the Sceneswitcher ends up in an unexpected state.
Here are a few points to check:
• Make sure your scene switch code is only triggered via the button click handler. If you’re invoking your scene load function in Start, Awake, or Update, it might be auto-loading another scene.
• Verify that the indices in your Sceneswitcher array match your intended scenes and that no accidental call is passing the wrong scene index.
• If you’re using DontDestroyOnLoad for the Sceneswitcher, confirm that duplicate instances aren’t being created after switching scenes. Multiple active SceneSwitchers can conflict and trigger unexpected behavior.
• There was a known regression related to Object3D entries in the Sceneswitcher’s scene array (see the changelog fixes at CHANGELOG.md). Upgrading to the latest Needle Engine version might resolve issues stemming from that regression.
I recommend adding some debug logs inside your scene load functions to track when and why they’re called. That can help pinpoint if any auto-triggered calls are unintentionally firing.
If these suggestions don’t resolve the issue, please share your Sceneswitcher script code so we can take a closer look.
Hope that helps!
1 replies left - Become PRO for more replies.
thread_vxCckAxN8vpasUwyXS6Y2ULY
Reply to this post directly if you need further help (bottom right button)
Hey –
do you have a link to share where we can look at the issue? This shouldn’t happen, and SceneSwitcher is tested and used quite extensively. Which Needle version are you on?
Hello! I am on version 4.5.9 on Needle and Unity 6000.0.39. I imagine the link that is created by exporting locally is only accessible by me, so how can I go about making a link to share with you?
Thanks for sharing the versions!
You can click on “Upload to Needle Cloud” and paste the link here after it has uploaded.
Unfortunately my build is failing so I cannot upload it to needle cloud I am getting the following errors when trying to build..
Can you upload a bug report then via menu:
Needle Engine > Bug Report > From current scene
?
Thanks!
Okay I think I have uploaded the bugreport now. It is titled SceneSwitcher not working and build failing sorry I didn’t notice there was a possibility to add a link to this thread so it is empty but hopefully you’ll be able to find it. Thanks for looking into this!