Instantiate new object from scratch


is there a way to Instantiate a new prefab object without dragging the prefab to public variable or having an existing copy of the prefab in the scene (and use “findGameObjectWithTag” )?

basically i’m trying to fill a List array with some prefabs but the list of prefabs can be changed. so i don’t want to drag all of them to variables.


You can have your prefabs in a Resources folder. Everything inside a Resources folder will be added to the build - regardless of actually being used - so only add necessary objects.

You can load resources from a Resources folder with Resources.Load during runtime.