Properly reloading scene _ NEED URGENT HELP

Hey guys,
I’m in a bit of a rush because I should have done a release a few hours ago and I’m still struggling with a thing I cannot understand.

I created an object in a scene and then when I go to the main menu and go back to this scene my objects are still there even if there should not be created yet.

public GameObject toInstantiate;

public CreateObject(){
  GameObject temp = Instantiate(toInstantiate) as GameObject;
}

this is how I create the object.

Please help me, how can I reload the scene from 0?

For start you can check two things.

  • Make sure objects are not already in the scene
  • When is CreateObject() called if its by some script on startup then they would be in scene as soon as it loads.

I would suggest putting breakpoint in CreateObject method and just check what is calling it.

1 Like

Thank you… I changed the way it was called and now it’s working