I have researched and looked up MANY resources, and have not come to ANY conclusion. If there is an expert out there please help me.
I have a class which is NOT part of my run time class, but my running class uses it to generate game objects. Hence I need to assign certain prefabs to be created using this class. Because unity won’t allow using assigned variables on classes by default, I am forced to include a path to the Prefab file. I have done the following:
clone = (GameObject) Instantiate (Resources.Load("Assets/Prefabs/Tile_Blue"), new Vector3 (0, -7, 1.5f), Quaternion.identity);
As you can see I have included the full path to my Prefab file. However, I get the following message.
ArgumentException: The Object you want to instantiate is null.
UnityEngine.Object.CheckNullArgument (System.Object arg, System.String message) (at C:/buildslave/unity/build/Runtime/Export/UnityEngineObject.cs:238)
UnityEngine.Object.Instantiate (UnityEngine.Object original, Vector3 position, Quaternion rotation) (at C:/buildslave/unity/build/Runtime/Export/UnityEngineObject.cs:150)
TileGenerator.Generate () (at Assets/Scripts/TileGenerator.cs:26)
PlayScene.Update () (at Assets/Scripts/PlayScene.cs:14)
If anyone has countered the problem please let me know, as I am very frustrated with this.