再度質問すみません。
Prefabをつかった複製をしようと思っているのですが、実行しても生成(複製?)されません。
実行はできるのですが、何がダメなのでしょうか?
C#
1using System.Collections; 2using System.Collections.Generic; 3using UnityEngine; 4 5public class CreateGround : MonoBehaviour { 6 public GameObject Gr0Prefab; 7 public GameObject Gr1Prefab; 8 public TextAsset StageData = Resources.Load ("SiromaruCandy") as TextAsset; 9 string StrData; 10 string[] StgData; 11 int Stage=1; 12 void Start () { 13 CreateGr(); 14 } 15 void StringSplit(){ 16 17 } 18 // Update is called once per frame 19 void Update () { 20 21 } 22 void CreateGr(){ 23 StrData = StageData.text; 24 StgData = StrData.Split(char.Parse("\n")); 25 int len = StgData[Stage-1].Length; 26 int n = 0; 27 while(n < len){ 28 string c= "0"; 29 GameObject gr0 = (GameObject)Instantiate(Gr0Prefab); 30 if(c =="0"){ 31 Instantiate(gr0, new Vector3(540*n-270, -360, 0), Quaternion.identity);//生成 x(540*n -270),y(-360) 32 } 33 n=n+1;//nを一ずつ変える 34 } 35 } 36}
回答1件
あなたの回答
tips
プレビュー