Hello! I ask a LOT of questions here, but this one is confusing. This may also answer a different question too, but I made a script for a door using an OnTriggerEnter function and for some reason it refuses to work. Here is the script:
#pragma strict
var LevelNum : int;
function OnTriggerEnter (PlayerCol : Collider)
{
if(PlayerCol.tag == "Player" && Input.GetKeyDown(KeyCode.E))
{
Application.LoadLevel(LevelNum);
}
}
This should work, but if the player goes to the door and presses E, it does nothing. I know I am doing the OnTriggerEnter right because I have other doors set up to display a GUIText to say that it is blocked or locked. Please help. This is confusing and makes no sense that it doesnât work. I may just restart the project to see if it is some problem with the assets or with the project itself. But, if there is just some simple error I missed then this will still be useful.