【ゲームエンジン】Unity初心者質問スレBuild1at GAMEDEV【ゲームエンジン】Unity初心者質問スレBuild1 - 暇つぶし2ch■コピペモード□スレを通常表示□オプションモード□このスレッドのURL■項目テキスト141:名前は開発中のものです。 18/07/03 18:43:10.13 DgOGkLki.net で、>>134を while (true) { // 子要素を全て取得する for (int i = 0; i < transform.childCount; i++) { Transform shotPosition = transform.GetChild(i); if(title.activeSelf == false){ // ShotPositionの位置/角度で弾を撃つ spaceship.Shot(shotPosition); } } // shotDelay秒待つ yield return new WaitForSeconds(spaceship.shotDelay); } と書き加えました。 もちろん、 // タイトルオブジェクトを取得 private GameObject title; // Titleゲームオブジェクトを検索し取得する title = GameObject.Find("Title"); をクラス内に記載もしました。 そしたら、敵がゲーム中も一切弾を撃たなくなりました。 エラー文は NullReferenceException: Object reference not set to an instance of an object Enemy+<Start>c__Iterator0.MoveNext () (at Assets/Scripts/Enemy.cs:46) UnityEngine.SetupCoroutine.InvokeMoveNext (IEnumerator enumerator, IntPtr returnValueAddress) (at /Users/builduser/buildslave/unity/build/Runtime/Export/Coroutines.cs:17) です。 次ページ最新レス表示レスジャンプ類似スレ一覧スレッドの検索話題のニュースおまかせリストオプションしおりを挟むスレッドに書込スレッドの一覧暇つぶし2ch