Instantiate loops itself

Hey, any idea why the Instantiate method just repeats itselft forever even in the Start method?

  void Start()
    {
        Instantiate(this, new Vector3(2f, 2f), Quaternion.identity);
    }

^ wherever i run this code it just keeps spawning my object.

Because you cloned “this”. Which runs Start on that new instance which calls Instantiate on itself. Which runs Start on that next instance which calls Instantiate on itself… ad infinitum.

2 Likes

Makes sense… Thanks.