I ran this code. And unity stopped. And unity gets closed after 1 to 10 min When I remove Instantiate this code works very well! How can I make this code run great?
Unity Editor.log file : https://github.com/Oein/UnityBuilds/blob/main/Editor.log.zip
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class MakeGround : MonoBehaviour
{
public Sprite ground;
public Sprite leftGround;
public Sprite rightGround;
string[] map = {
"aaaaaaaaaa",
"aaaaaaaaaa",
"aaaaaaaaaa",
"zxxxxxxxxc"
};
// Start is called before the first frame update
void Awake()
{
for (int y = 0; y < map.Length; y++)
{
for (int x = 0; x < map[0].Length; x++)
{
print(x.ToString() + " At " + y.ToString());
this.transform.position = new Vector3(x, y, 0);
if (map[map.Length - 1 - y][x] != 'a')
{
Instantiate(gameObject , transform);
}
}
}
}
// Update is called once per frame
void Update()
{
}
}