unityを学び始めたものです。
unity2Dで教本を元にアクションゲームを作っているのですが。
物理エンジンの箱を戦車の砲弾で崩すサンプルゲームを実装中に以下のエラーメッセージが発生しました。
###発生している問題・エラーメッセージ
scriptをspriteにドロップ&ドラッグしようとしたとき
Please fix compile erros before creating new script components
compileタグにでてるエラーメッセージ
here are inconsistent line endings in the 'Assets/scrips/core.cs.cs' script.
Some are Mac OS X (UNIX) and some are Windows.
This might lead to incorrect line numbers in stacktraces and compiler errors.
Many text editors can fix this using Convert Line Endings menu commands.
UnityEditor.DockArea:OnGUI()
Assets/scrips/core.cs.cs(4,18): error CS8025: Parsing error
Assets/scrips/tahk.cs.cs(4,18): error CS8025: Parsing error
###該当のソースコード
C#言語
1using UnityEngine; 2using System.Collections; 3 4public class tahk.cs : MonoBehaviour { 5 gemeobject goshell = null; 6 bool action = false; 7 8 9 // Use this for initialization 10 void Start () { 11 //砲弾のゲームオブジェクト取得と砲弾の非表示設定 12 goshell = Transform.findchild("tahk_sell").gameobject; 13 goshell.setActive(false); 14 } 15 16// Update is called once per frame 17void Update() { 18 if (Input.GetMouseButton(0)) { //ボタンが押されたか?? 19 //タンクがクリックされたか?? 20 Vector2 tappoint = Camera.main.ScreenToWorldPoint(Input.mouseposition); 21 Collider2D collition2d = Physics2D.OverlapPoint(tappoint); 22 if (collition2d.gameObject == GameObject) { 23 action = true; //アクションを無効にする 24 } 25 } 26 if (action) { //ボタンが押されたままか? 27 //タンク移動 28 Rigidbody2D.Addforce(new Vector2(+30.0f, 0.0f)); 29 } 30}else{ 31 if(Input.GetMouseButtonup(0)&& action){ //ボタンが押されたか? 32 //砲弾発射 33 if(gosell){ 34 gosell.setactive(ture); 35 gosell.rigibody2D.AddFoce(new vector2(+300.0f,500.0f)); 36 Destroy(gosell.gameobject,3.0f); 37 } 38 action=false; 39 } 40 } 41} 42 43void OnGUI() { 44 GUI.TextField(new Rect(10, 10, 300, 60,), 45 "[unity2Dでゲームを作る本 sample 2_1]\n戦車をクリックすると加速\はなすと発射!"); 46 if (GUI.Button(new Rect(10, 80, 100, 20,), "リセット")) { 47 Application.LoadLevel(Application.loadedLevelName); 48 } 49 } 50} 51 52###試したこと 53現在エラー原因検索中 54###補足情報(言語/FW/ツール等のバージョンなど) 55より詳細な情報
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。