So in my current game, I have to instantiate the player’s character model from a prefab that is kept in the “Resources” folder. Here is the current portion of my script:
void SelectedCharacter2 ()
{
Application.LoadLevel("Battlefield");
Debug.Log ("Onion Selected");
SelectedCharacter = 2;
Instantiate (Resources.Load ("Onion") as GameObject);
The “Battlefield” scene is supposed to load in and immediately the code is supposed to instantiate and load in the “Onion” object from its folder (This happens after the player clicks a certain object, but I don’t believe that is important). Unity currently loads in the scene correctly, but the object will not instantiate into the scene. I have double checked and the prefab is both named “Onion” and is contained in the folder “Resources” which is contained in the Assets folder. Any idea what I might be doing wrong?