Я хочу создать вид, подобный сетке, с префабами внутри вида камеры, но я не могу этого сделать. префабы выходят из вида Кто-нибудь может помочь мне решить это я хочу поместить сборный как сетку и сетку 9 * 6.
public GameObject tilePrefab;
Vector2 mapSize;
void Start()
{
createGrid();
Debug.Log("Screen Width : " + Screen.width);
Debug.Log("Screen Height : " + Screen.height);
mapSize = new Vector2(Screen.width/9,Screen.height/12);
Debug.Log("mapSize : " + mapSize);
}
void createGrid()
{
for (int x = 0; x < 9; x++)
{
for (int y = 0; y < 6; y++)
{
Vector3 tilePosition = new Vector3(-mapSize.x+0.5f + x,-mapSize.y + 0.5f+y ,0 );
GameObject ballclone = (GameObject)Instantiate(tilePrefab,tilePosition,Quaternion.identity);
ballclone.transform.parent = transform;
}
}
}