I have never faced the problem before, restarted and created new several projects
The code is given below :
public GameObject box;
int i = 0;
void Start()
{
Debug.Log(i);
//Gen();
}
public IEnumerator Gen()
{
while(true)
{
GameObject tem = Instantiate(box, new Vector3( i , 0, 0), Quaternion.identity);
i += 6;
Debug.Log(i);
yield return new WaitForSeconds(0.5f);
}
}
// Update is called once per frame
void Update()
{
}
’