Hi! I need a lil help with something
So i wanna make a 2d game where the player is in a room and in order to leave that room they have to click on a door with a cursur and they basically get teleported into another scene. Thing is i dont know a lot of coding and i dont know how to phrase it in a way so that the right tutorial will show up (the tutorials are mostly about the player walking to the door and automatically appearing at the next scene or the door just opening instead of leading to another scene). So if there is any way to help then that’ll be much appreciated!
There are many ways to do this , but just to give you the most direct & simple solution , you can use a component called “Event Trigger” , the setup should be like this :
- Go to your camera in the scene and make sure it has “Physics Raycaster” component on it , make sure the door is included in the layers
- Go to your door and make sure it has a collider on it
- Go to your door and add the “Event Trigger” component
- Click on “Add New Event Type” select “PointerClick”
- The setup here should be the same a the setup of a UI Button , drag the object/script that has the method you want to call on click and select the method
- The method should be called on click now