A password for a Gate

Hello everyone! I’m developing an educational game for my Master’s Degree thesis. I wanted to develop a Script containing a simple password system, but I didn’t have the qualification, I must admit. I hope you can help me out. In the picture that I’ve posted there is my “FPS character” in front a Gate. I want a Script that, once my “FPS Character” is nearby, shows the message “Press ENTER to write the Password”. Once you press ENTER, I wanna a space where the password can be inserted, with the possibility to EXIT without writing any password. Once the correct password is inserted, the Script must apply a “transform.Translate” function that moves the Gate down, allowing the character to go through. That said, the Script must allow me to write the password in the “Inspector” window, as we normally do with “Transform” variables. If you could make a “Transform” variable to store the “FPS Character” just to check the distance between the main character and the gate, it will be a positive thing. I don’t have any preferences between C# and JavaScript. Can you guys help the cause? I’ll be waiting. Greetings from Brazil!

An easier way to detect if the FPS is nearby is to add a sphere collider to the gate with the radius you want to check. Then make it a trigger and put into your gate script OnTriggerEnter and go from there.

For the password part, you have to try something with the gui of unity.