我用unity制作了一款俄罗斯方块游戏,但这段代码并没有产生我的tetrimino。我已经将我的游戏对象分配给了group[]数组。
这是我的代码:
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);
}
}发布于 2016-08-31 05:55:20
它没有生成,因为您在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);
}
}https://stackoverflow.com/questions/39237530
复制相似问题