Hi, In a level I am currently making I need the player to teleport once they look at an object.
I have this script currently. (in Javascript)
#pragma strict
function Start () {
}
function Update () {
}
var destination : Transform;
function OnMouseEnter (other : Collider)
{
if (other.tag == "Player") {
other.transform.position = destination.position;
}
}
However, once I run the script after attaching it to the object and putting my mouse on it, I get the following error:
Failed to call function OnMouseEnter of class HoverBotTeleportPlayer
Calling function OnMouseEnter with no parameters but the function requires 1.
UnityEngine.SendMouseEvents:DoSendMouseEvents(Int32, Int32)
If anyone could explain why this happens and tell me how to fix it I would be extremely grateful.
Thanks,
drjordanmathew