Answer the question
In order to leave comments, you need to log in
What to do if prefabs are not loaded after DestroyImmediate?
the code worked normally, everything was displayed normally
GameObject Prefab = null;
string LoadPrefab = "Test/Test1";
if(Resources.Load(LoadPrefab, typeof(GameObject)) as GameObject!=null){
Prefab = Resources.Load(LoadPrefab, typeof(GameObject)) as GameObject;
ObjectsList[id] = Instantiate(Prefab, new Vector3(0, 0, 0), Quaternion.identity);
Destroy(Prefab);
ObjectsList[id].AddComponent<StructureData>();
ObjectsList[id].GetComponent<StructureData>().id = id;
}
DestroyImmediate takes destruction out of the normal script execution order.
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question