2016-08-30 79 views
1

我正在製作與團結的俄羅斯方塊遊戲,但此代碼不會產生我的tetrimino。我已將我的遊戲對象分配給組[]數組。GameObject不產生

這是我的代碼:

using UnityEngine; 
using System.Collections; 

public class Spawner1 : MonoBehaviour { 

    public GameObject[] group; 
    void start(){ 
     SpawnNext(); 
    } 
    void SpawnNext(){ 
     Instantiate(group[Random.Range(0,group.Length)],new Vector2(5.0f,10.0f),Quaternion.identity); 
    } 
} 
+0

對於明顯有錯別字的問題,請選擇關閉理由Off Topic> Typo/Not Reproducible。 – Serlite

回答

1

它不產卵,因爲你在start使用小寫s。這應該是Start而不是start。請解決這個問題,你的對象現在應該開始產卵。

public class Spawner1 : MonoBehaviour { 

    public GameObject[] group; 
    void Start(){ 
     SpawnNext(); 
    } 

    void SpawnNext(){ 
     Instantiate(group[Random.Range(0,group.Length)],new Vector2(5.0f,10.0f),Quaternion.identity); 
    } 
}