-3
發生在所有出現的'{'和')'錯誤 我沒有看到任何錯誤?在類,結構體或接口成員聲明中出現無效的令牌')'和'{'
// Kills the game object
Destroy{}(gameObject);
// Removes this script instance from the game object
//Destroy(this);
// Removes the rigidbody from the game object
Destroy{}(rigidbody);
// Kills the game object in 5 seconds after loading the object
Destroy{}(5, gameObject);
// When the user presses Ctrl, it will remove the script
// named FooScript from the game object
void Update()
{
if (Input.GetButton("Fire1"))
GetComponent<FooScript>();
{
Destroy(GetComponent<MonoScript>());
}
}
爲什麼你認爲你需要'{}'?只需在所有情況下刪除'{}',它就會起作用。 'Destroy {}(gameObject);'應該是'Destroy(gameObject);' – Rob
...除非在'void Update()'中。 :-) – LarsTech
@LarsTech是的,我想我不清楚 - 我的意思是所有的具體'{}'的情況下,通常不是大括號:) – Rob