Hei all,
i want to make it quite Short. I know there is a possibility to get all Prefabs from a Folder (MapsFolder) in one ArrayList? i tried it a lot with searchin but there are just rly old Tutorials with outdated stuff.
Thanks for your Help
Hei all,
i want to make it quite Short. I know there is a possibility to get all Prefabs from a Folder (MapsFolder) in one ArrayList? i tried it a lot with searchin but there are just rly old Tutorials with outdated stuff.
Thanks for your Help
I tried it like that:
public GameObject[] allMaps;
void Start () {
allMaps = Resources.LoadAll("Assets/Prefabs/Maps")as GameObject[];
Debug.Log("Maps " + allMaps[0] +" Geladen");
Debug.Log("Maps " + allMaps[1] + " Geladen");
}
but i got an Error in Unity: NullReferenceException : Object reference not set to an instace of an object
You should probably re-read the documentation: Unity - Scripting API: Resources.LoadAll
Your prefabs must be placed in a folder called “Resources”