unityでゲームを作っています。linerendererで折れ線をつくり、それをスクリプトで任意の場所に出現させたいです。
linerendererの線はスクリプトではなく、手動で作成したものを使いたいです。
↓のような折れ線を作りました。
これをゲーム上で任意の場所にスクリプトで出現させたいです。
objという名前のオブジェクトにして、prefab化しました。
objはResourcesファイルに入れています。
このprefabをスクリプトで出現させたいのですが、以下のようなスクリプトではうまくいきません。もちろん、スクリプトを空のオブジェクトにアタッチして実行しております。完全に詰まってしまい進みません。ご意見いただけますとありがたいです。宜しくお願い致します。
C#
1 2using System.Collections; 3using System.Collections.Generic; 4using UnityEngine; 5 6public class NewBehaviourScript : MonoBehaviour 7{ 8 // Start is called before the first frame update 9 void Start() 10 { 11 GameObject objs = (GameObject)Resources.Load("obj"); 12 Instantiate(objs, new Vector3(0.0f, 2.0f, 0.0f), Quaternion.identity); 13 } 14 // Update is called once per frame 15 void Update() 16 { 17 } 18}
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。