意外的char错误

时间:2013-04-27 21:20:02

标签: unity3d unityscript

有人可以告诉我这个脚本有什么问题吗?

#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;
    } 
}
}

1 个答案:

答案 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;
    } 
}