I have a Script inside a Scene that loads Prefabs from a Resources folder that I created. Inside this Resources folder I have 2 Prefabs (Lets call them Prefab 1 and Prefab 2 for simplicity's sake). I can successfully load Prefab 1 and set it to an empty GameObject in my Script. After I load Prefab 1 when I try to load Prefab 2 its value is null. Note: I have a Debug.Log() that logs Prefab 2 (To see its value) and before I load Prefab 1 it returns the correct GameObject value, but after I load Prefab 1 it returns null. Sample Code: Code (CSharp): using UnityEngine; using System.Collections; // I created this sample code that acts exactly like the original one. // (Taking out other parts of code that do not influence on the loading of Prefabs). public class Loader : MonoBehaviour { // The object that holds this Script is destroyed and a new GameObject is // instantiated and given this same Script but has its loadNext set to true. public bool loadNext; public GameObject loadedObject; private void Start () { Debug.Log(Resources.Load<GameObject>("Prefab 2")); if (!loadNext) { loadedObject = Resources.Load<GameObject>("Prefab 1"); } else { loadedObject = Resources.Load<GameObject>("Prefab 2"); } } } Any help much is appreciated. Thanks for reading.
I think you might get better help if you post some snippets of code showing what you are attempting. Be sure to enclose it with the correct tags for formatting (the word code in square brackets; see the help files).
Are you perhaps forgetting to instantiate the loaded resources? I don't see that code anywhere... This will just create references in code to the on- disk assets, not add anything to the scene.