I wanted the program to change level when player presses key ‘e’, but the script I wrote wrote doesn’t work.
Can you help me, please.
I wanted the program to change level when player presses key ‘e’, but the script I wrote wrote doesn’t work.
Can you help me, please.
Take Keycode.E out of quotes. Don’t need them when you use KeyCode.
Also, don’t put it in OnTriggerEnter. That happens instantly and it would be next to impossible to hit the button exactly when entering the trigger. Use OnTriggerStay instead. And make sure your trigger is set up correctly. Better still, just make a bool that turns true when entering the trigger and then put it in the update that first checks the bool before loading the scene.
In the future, please post code as code, not as an image.
–Eric
I will. Thanks
It works but it changes the level wherever I am and it’s not what I wanted. I want to use ‘e’ to change level only on certain area of the game.