【ゲームエンジン】Unity初心者質問スレBuild1at GAMEDEV
【ゲームエンジン】Unity初心者質問スレBuild1 - 暇つぶし2ch141:名前は開発中のものです。
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)
です。


次ページ
続きを表示
1を表示
最新レス表示
レスジャンプ
類似スレ一覧
スレッドの検索
話題のニュース
おまかせリスト
オプション
しおりを挟む
スレッドに書込
スレッドの一覧
暇つぶし2ch