- Home /
Key/Door to new scene
I am have just coming back to Unity(3D) I'm making a VR game where you have to open a door with a key. So they just touch the key on the door and it takes you to a new scene. Any tutorial, answers or tips would be amazing!
You might want to look into script manager class. https://docs.unity3d.com/ScriptReference/Scene$$anonymous$$anagement.Scene$$anonymous$$anager.html
The flow would be upto you, but all you may want to do, is set the trigger points to the door(perhaps create a trigger on door and then make the prefab of it), Later, just check if the trigger has been activated from player gameobject, if yes, then load the scene you wish to by calling scenemanager.loadscene method. It also takes index as an input. https://docs.unity3d.com/ScriptReference/Scene$$anonymous$$anagement.Scene$$anonymous$$anager.LoadScene.html
Tip : You will need to call the namespace first before using it, it's using UnityEngine.Scene$$anonymous$$anagement;
Also, check this, https://answers.unity.com/questions/1249009/how-do-you-use-scenemanager.html
Answer by logicandchaos · Jan 09, 2020 at 01:09 PM
you just need to tag your objects as key and door and then you check the tag on collision and take appropriate action.
Your answer
Follow this Question
Related Questions
How do I edit a second scene when my objects are still in the first? 1 Answer
This script is not displaying scenes in unity properly. How would you fix it? 0 Answers
Audio not working properly after scene change 0 Answers
after click a GUI button from Menu to Game there are two screens 1 Answer
UI Scene ending with Text 1 Answer