I like to switch scene when a 3d object is touched. I have looked at the Multi-scene sample but cant figure how it is done. In theory I should be able to attach a script to an object, make it clickable and it should work.
Do I just do this using unity or are there scripts which I can use?
Hi there! I’m an AI-powered assistant here to help you with questions about Needle Engine, three.js, as well as basic Unity or Blender help. Please provide your OS, Needle Engine version, and the Unity version you’re using so I can assist you further!
2 replies left - GPT 4O thread_RC84KX04C0bw1VbsE8gKRhCo Reply to this message to continue the conversation
Use the SceneSwitcher component and call the next() method on the sceneSwitcher when your object is clicked. E.g. if this should apply to ALL objects that are loaded then just add a SceneSwitcher to an Empty Object, add your prefabs to the Scenes Array (just click the Plus button and drag them in the list, can be actual Unity scenes too) and also add a Button component to the same GameObject and add a call to “next()” in the onClick Event
If you prefer writing scripts you can load new scenes with “new AssetReference().instantiate({parent: })” for example. Make sure to destroy the spawned instances once you dont need them anymore. There are plenty of examples in the docs/samples or on stackblitz let me know if you prefer this route so I can send you more
I believe tho that the SceneSwitcher approach does perhaps already all you want and this is what I would suggest you to try first
Thanks @marcel. I have tried the first method (i.e. using a button and SceneSwitcher). When I run the program, it loads the first scene and then immediately loads the second one. This is what I have included in my button click.
The loading scene should probably not be assigne to AR-scene. The loading scene is what is displayed during loading one of the scenes in the scenes array. You can just leave it empty for now.