Instantiate not spawning prefab

I have a script that spawns a player when you press the play button from a different script. Everything is working fine, but the thing is the prefab isn’t showing up. Heres the code:

var playerGM : GameObject; 

var startFlagPos : Vector3;
var startFlag : GameObject;

function Update () {
	if (WorldEditWindow.test == true) { 
		startFlag = GameObject.Find("Start Flag");
		if (!startFlag) {  
			Debug.LogWarning("There is no Start Flag in the level!");
		} else { 
			Debug.Log("Spawning Player...");
			startFlagPos = startFlag.transform.position;
			Instantiate(playerGM, startFlagPos, Quaternion.Euler(0,0,0));
			
			GameObject.Find("Main Camera").SetActive(false);
			GameObject.Find("VisualizerCube").SetActive(false);
			GameObject.Find("BuildGrid").SetActive(false);
			GameObject.Find("BuildGridBottom").SetActive(false);
		}
	}
}	

I tested everything, and everything is working, the start flag is being found and such, but Instantiate is just not working in general.

Create a resources folder and asset’s and pick apart the code I’ve used in another game:

If you miss the (Clone) bit instantiate adds, it can lead a person astray.

void OnLevelWasLoaded() {
GetComponent ();

	if (OnSelectGui.maleDemonKnight == true){
	GameObject newPlayer = (GameObject)Instantiate(Resources.Load("DarkKnight"));
	}
	if (OnSelectGui.femaleDemonKnight == true){
	GameObject newPlayer = (GameObject)Instantiate(Resources.Load("DemonFem"));
	
	}

void Start () {
	
var spawn = GameObject.Find("spawn");
var DarkKni = GameObject.Find("DarkKnight(Clone)");
var DarkFem = GameObject.Find("DemonFem(Clone)");

if (OnSelectGui.maleDemonKnight == true){
DarkKni.transform.position = spawn.transform.position;
}
if (OnSelectGui.femaleDemonKnight == true){	
DarkFem.transform.position = spawn.transform.position;
	}

}

Ok i got it to work! What I did is that when the Start Flag is spawned, I disabled that script that I said destroys the blocks thats in the same location. So now it works perfectly!

Its funny how people (thats me) panic but then it was a very dumb mistake! :slight_smile:

Thanks all!