In our game, we have a prefab we want to insert into the scene in a C# script. It works fine when dragged and dropped into the script, but when we use this code:
GameObject prefab = Resources.Load<GameObject> ("Prefabs/StarDude");
Instantiate (prefab, new Vector3(0f, 2f, 0f), Quaternion.identity);
Then nothing appears in our scene when we run it. This is code is in the start function of a monobehaviour, could this be the problem? Can it not add to the scene while starting up? Should anything be appearing in the hierarchy when we run the game? Or are we missing something simple? We also tried making a public variable for the prefab and setting it in the inspector, and this didn’t work either. Any help is appreciated.