有人可以告诉我这个脚本有什么问题吗?
#pragma strict
private var dead = false;
function OnControllerColliderHit(hit : ControllerColliderHit)
{
if(hit.gameObject.tag == "Respawn")
{
dead = true;
}
}
function Update ()
{
if(dead)
{
transform.position = Vector3(0,0,0);
dead = false;
}
}
}
答案 0 :(得分:0)
从最后一行删除最后一个}
,或者复制并粘贴这一行:
#pragma strict
private var dead = false;
function OnControllerColliderHit(hit : ControllerColliderHit)
{
if(hit.gameObject.tag == "Respawn")
{
dead = true;
}
}
function Update ()
{
if(dead)
{
transform.position = Vector3(0,0,0);
dead = false;
}
}