質問内容
Visual Studioを使ってUnityのコードを書いてるときに、';' がついているのに、エラーが発生しました。
発生している問題・エラーメッセージ
error CS1002: ; expected
該当のソースコード
C#
1 private void move_down(int x, int y, int color)2 {3 x++;4 y++;5 float x_1 = (217.05f + (x * 0.985f));6 float y_1 = (336.428f - (y * 0.985f));7 if (color == 1)8 {9 GameObject object = GameObject.Find("blue");10 Vector3 pos = object.transform.position;11 blue.transform.position = new Vector3(x_1, y_1, 0.0f);12 }13 else if (color == 2)14 {15 GameObject object = GameObject.Find("orange");16 Vector3 pos = object.transform.position;17 orange.transform.position = new Vector3(x_1, y_1, 0.0f);18 }19 else if (color == 3)20 {21 GameObject object = GameObject.Find("pink");22 Vector3 pos = object.transform.position;23 pink.transform.position = new Vector3(x_1, y_1, 0.0f);24 }25 else if (color == 4)26 {27 GameObject object = GameObject.Find("purple");28 Vector3 pos = object.transform.position;29 purple.transform.position = new Vector3(x_1, y_1, 0.0f);30 }31 else if (color == 5)32 {33 GameObject object = GameObject.Find("white");34 Vector3 pos = object.transform.position;35 white.transform.position = new Vector3(x_1, y_1, 0.0f);36 }37 }
エラーの発生源
GameObject object = GameObject.Find("オブジェクト名");
のところでエラーが発生しています。
';'のところを書き直してもエラーが消えません。どうすればいいですか?
初心者ですいません。

0 コメント