Question by
deadlypunch0 · Jul 08, 2020 at 11:02 PM ·
triggercollision2dscene-change
Enter button
I am trying to make a 2D sidescroller and i made a door, it has a collision2D and i want the player to enter the door when they player is inside the collider and enters the enter button which triggers changescene. I am new to programming also to making games and i can't see what i am doing wrong here when i delete the if part, the player enters the door directly when gets inside the collider, i dont want that to happen.
private void OnTriggerEnter2D(Collider2D other) { if (Input.GetKeyDown(KeyCode.Return)) { SceneManager.LoadScene(SceneManager.GetActiveScene().buildIndex + 1); } }
Comment
Your answer
Follow this Question
Related Questions
Need help with trigger event! 0 Answers
Act like a Trigger only with specific object 0 Answers
detect a trigger one time per collision 2 Answers
Trying to get bool statement to work in OnTriggerStay2D 1 Answer
Moving triggers possible? 0 Answers