好吧,所以我一直在Unity 2D中构建一个小东西,并且大部分情况下都可以使用,但是,每当我尝试创建脚本以生成圆形预制件的副本时,如果没有任何错误消息。
我试图使用Instantiate在按钮的位置生成它们,但是没有运气。
{
public GameObject circle;
public Transform circlespawn;
private bool touched = false;
void Update()
{
if(touched == true)
{
Instantiate(circle, circlespawn.position, circlespawn.rotation);
touched = false;
}
}
void OnMouseDown()
{
touched = true;
}
}