Door scripting, changing scenes

Hi. Im new at making scripts and programming. How can i make a script that when the character is near the door and then click the door and appear a button saying enter and change the scene ? Sorry my bad language.

  1. Make door script.
  2. Ensure door object has collider to check for mouse clicks
  3. In door script have public variable for level name or index in build settings.
  4. When door is clicked have UI button appear on a canvas
  5. Have same door script have an attached event to button
  6. When button is clicked have it invoke SceneManagement.LoadLevel(PublicVariableNameThatYouSetInInspectorFOrNextLevel)

Edit:
My suggestion is to use the search box at the top of the site and search for “door script” it’s an extermely common question and you may learn something which will be more useful for you.

When i just searched i got 112325 results, plenty of examples and problems/implementation others have had/used.

We made a tutorial on how to change scenes and end up in the right spot on our channel.

Hope this helps!