前提・実現したいこと
Unityの2Dプロジェクト(音ゲー)のノーツがエディターだと降ってくるんですが実機のiosに移すと動かなくなります。
生成はされていますが、動かない状況です
発生している問題・エラーメッセージ
音ゲーのノーツ(clone)が生成されるが動作しない
該当のソースコード
C#
1//移動するノーツにアタッチされているスクリプト 2using System.Collections; 3using System.Collections.Generic; 4using UnityEngine; 5using GokUtil.UpdateManager; 6using System.Linq; 7public class NotesIdou2 : MonoBehaviour 8{ 9 [SerializeField] private Score AnotherScript; 10 // Start is called before the first frame update 11 void Start() 12 { 13 14 } 15 16 17 void AddScore(int y) 18 { 19 GameObject AnotherObject = GameObject.Find("Score GUI"); 20 AnotherScript = AnotherObject.GetComponent<Score>(); 21 AnotherScript.AddPoint(y); 22 } 23 public void Hantei() 24 { 25 float y; 26 var clones = GameObject.FindGameObjectsWithTag("2"); 27 foreach (var clone in clones) 28 { 29 Vector3 tmp = clone.transform.position; 30 y = tmp.y; 31 32 if (y >= -1.0f && y <= 1.0f) 33 { 34 AddScore(500); 35 Destroy(clone); 36 } 37 else if (y >= -2.0f && y < -1.0f || y <= 2.0f && y > 1.0f) 38 { 39 AddScore(300); 40 Destroy(clone); 41 } 42 43 } 44 45 46 47 } 48 public void Idou(int a, int b, int c) 49 { 50 StartCoroutine(Idou2(a, b, c)); 51 } 52 public IEnumerator Idou2(int a, int b, int c) 53 { 54 yield return new WaitUntil(() => Timing(a, b, c) == true); 55 Transform myTransform = this.transform; 56 Vector3 worldPos = myTransform.position; 57 for (int i = 0; i < 66; ++i) 58 { 59 worldPos.y -= 0.2f; 60 yield return null; 61 myTransform.position = worldPos; 62 } 63 Destroy(gameObject); 64 } 65 66 public bool Timing(int a, int b, int c) 67 { 68 return Music.IsJustChangedAt(a, b, c); 69 70 } 71 72}
C#
1//問題はないと思いますがクローンを生成するスクリプト 2using System.Collections; 3using System.Collections.Generic; 4using UnityEngine; 5using System; 6 7public class Humen1 : MonoBehaviour 8{ 9 public GameObject Notes; 10 public GameObject Notes2; 11 public GameObject Notes3; 12 public GameObject Notes4; 13 public GameObject Notes5; 14 public GameObject Notes6; 15 public GameObject Notes7; 16 public GameObject Notes8; 17 public GameObject Notes9; 18 public GameObject Notes10; 19 20 public int z = 0; 21 int x = 0; 22 /* 23 float a; 24 float b; 25 float c; 26 float d; 27 float e; 28 float a1; 29 float b1; 30 float c1; 31 float d1; 32 float e1; 33 */ 34 // Start is called before the first frame update 35 36 void Start() 37 { 38 StartCoroutine(Wait()); 39 StartCoroutine(Junbi()); 40 FadeManager.FadeIn(); 41 } 42 43 // Update is called once per frame 44 public int Jikkou 45 { 46 // 取得 47 get { return z; } 48 49 // 変更 50 set { z = value; } 51 } 52 public IEnumerator Junbi() 53 { 54 yield return new WaitUntil(Z); 55 Jikkou1(); 56 } 57 public void Jikkou1() 58 { 59 int a; 60 int b; 61 int c; 62 float d; 63 float e; 64 float[,] notes1; 65 notes1 = new float[,] { 66 {2, 1, 0, -3.7f, 6} 67 //{, , , , } 68 }; 69 int y = notes1.Length; 70 for (int i = 0; i <= y; i++) 71 { 72 a = (int)notes1[i,x]; 73 ++x; 74 b = (int)notes1[i, x]; 75 ++x; 76 c = (int)notes1[i, x]; 77 ++x; 78 d = notes1[i, x]; 79 ++x; 80 e = notes1[i, x]; 81 ++x; 82 83 if (Mathf.Approximately(e, 6.0f)) 84 { 85 switch (d) 86 { 87 case -7.4f: 88 GameObject notes = Instantiate(Notes, new Vector3(d, 6.0f, 0.0f), Quaternion.identity) as GameObject; 89 NotesIdou a_1 = notes.GetComponent<NotesIdou>(); 90 a_1.Idou(a, b, c); 91 break; 92 case -3.7f: 93 GameObject notes2 = Instantiate(Notes2, new Vector3(d, 6.0f, 0.0f), Quaternion.identity) as GameObject; 94 NotesIdou2 a_2 = notes2.GetComponent<NotesIdou2>(); 95 a_2.Idou(a, b, c); 96 break; 97 case 0: 98 GameObject notes3 = Instantiate(Notes3, new Vector3(d, 6.0f, 0.0f), Quaternion.identity) as GameObject; 99 NotesIdou3 a_3 = notes3.GetComponent<NotesIdou3>(); 100 a_3.Idou(a, b, c); 101 break; 102 case 3.7f: 103 GameObject notes4 = Instantiate(Notes4, new Vector3(d, 6.0f, 0.0f), Quaternion.identity) as GameObject; 104 NotesIdou4 a_4 = notes4.GetComponent<NotesIdou4>(); 105 a_4.Idou(a, b, c); 106 break; 107 case 7.4f: 108 GameObject notes5 = Instantiate(Notes5, new Vector3(d, 6.0f, 0.0f), Quaternion.identity) as GameObject; 109 NotesIdou5 a_5 = notes5.GetComponent<NotesIdou5>(); 110 a_5.Idou(a, b, c); 111 break; 112 } 113 }else{ 114 //if (Mathf.Approximately(e, -6.0f) 115 switch (d) 116 { 117 case -7.4f: 118 GameObject notes6 = Instantiate(Notes6, new Vector3(d, -6.0f, 0.0f), Quaternion.identity) as GameObject; 119 NotesIdou6 a_6 = notes6.GetComponent<NotesIdou6>(); 120 a_6.Idou(a, b, c); 121 break; 122 case -3.7f: 123 GameObject notes7 = Instantiate(Notes7, new Vector3(d, -6.0f, 0.0f), Quaternion.identity) as GameObject; 124 NotesIdou7 a_7 = notes7.GetComponent<NotesIdou7>(); 125 a_7.Idou(a, b, c); 126 break; 127 case 0: 128 GameObject notes8 = Instantiate(Notes8, new Vector3(d, -6.0f, 0.0f), Quaternion.identity) as GameObject; 129 NotesIdou8 a_8 = notes8.GetComponent<NotesIdou8>(); 130 a_8.Idou(a, b, c); 131 break; 132 case 3.7f: 133 GameObject notes9 = Instantiate(Notes9, new Vector3(d, -6.0f, 0.0f), Quaternion.identity) as GameObject; 134 NotesIdou9 a_9 = notes9.GetComponent<NotesIdou9>(); 135 a_9.Idou(a, b, c); 136 break; 137 case 7.4f: 138 GameObject notes10 = Instantiate(Notes10, new Vector3(d, -6.0f, 0.0f), Quaternion.identity) as GameObject; 139 NotesIdou10 a_10 = notes10.GetComponent<NotesIdou10>(); 140 a_10.Idou(a, b, c); 141 break; 142 } 143 } 144 145 146 } 147 } 148 private bool Z() => z == 1; 149 IEnumerator Wait() 150 { 151 yield return new WaitForSeconds(1f); 152 } 153 154} 155 156 157
試したこと
ビルド設定を変えたり、カメラの視野角を広くしてそもそもノーツが生成されているか確認(生成はされていた)
補足情報(FW/ツールのバージョンなど)
Unity2019.2.5f1
ios12.4
回答1件
あなたの回答
tips
プレビュー