前提・実現したいこと
画面をクリックしたときに"Point"という名前のprefabを生成したい。
発生している問題・エラーメッセージ
ArgumentException: The Object you want to instantiate is null. UnityEngine.Object.CheckNullArgument (System.Object arg, System.String message) (at C:/buildslave/unity/build/Runtime/Export/UnityEngineObject.bindings.cs:383) UnityEngine.Object.Instantiate[T] (T original) (at C:/buildslave/unity/build/Runtime/Export/UnityEngineObject.bindings.cs:274) Uno.Update () (at Assets/Uno.cs:14)
該当のソースコード
C#
1using System; 2using System.Collections; 3using System.Collections.Generic; 4using UnityEngine; 5 6public class Uno : MonoBehaviour 7{ 8 void Update() 9 { 10 if (Input.GetMouseButton(0)) 11 { 12 GameObject prefab = (GameObject)Resources.Load("Prefabs/Point"); 13 Instantiate(prefab,new Vector3(0.0f,0.0f,0.0f),Quaternion.identity); 14 } 15 } 16 17}
回答2件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。