時間経過で決められた一位置プレハブから生成したい。
一か月ほどまえからunityを勉強しており、先日花火のアセット(https://assetstore.unity.com/packages/vfx/particles/ktk-fireworks-effects-volume1-26568?aid=1011lGbg&utm_source=aff)を購入し、現実の花火大会のように時間経過で花火を打ち上げたい!と思って色々調べて以下のコードを空のゲームオブジェクトにアタッチして実行してみたのですが、どうもうまくいきません。
発生している問題・エラーメッセージ
UnassignedReferenceException: The variable target of ObjectCreater1 has not been assigned.
You probably need to assign the target variable of the ObjectCreater1 script in the inspector.
該当のソースコード
using UnityEngine;
using System.Collections;
public class ObjectCreater1 : MonoBehaviour
{
//生成するゲームオブジェクト public GameObject target; void Update() { //5秒経過 if (Time.realtimeSinceStartup >5.0f) { //Instantiate( 生成するオブジェクト, 場所, 回転 ) Instantiate(target, transform.position, Quaternion.identity); } }
}
画像
回答2件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。