How to Instantiate Prefab without it Showing Beforehand?

Hello,

I’m trying to create a game object when my player has a score higher than 10. What’s the best way to do this?

Currently I have it set up by Instantiating a prefab. However, the problem with this is that it’s visible before the score is 10.

How can I make it either, invisible until the score is greater than 10?

If I delete the game object from the hierarchy, the prefab doesn’t work and it won’t spawn when the score is 10.

Any help is greatly appreciated.

Thank you.

Make sure you are telling it to instantiate an object from our project window, not your hierarchy. A prefab isn’t in your scene at all.
I’m guessing a little higher up in your script is

 public GameObject prefab;

That will create an exposed variable in your inspector that you can drag the prefab into. It will then instantiate an object that doesn’t exist in your scene yet. That’s why it is called a prefab., or “Prefabricated Object”. It isn’t an object in your scene or hierarchy, it is a blueprint with which you can create objects in your scene.

ok here’s a js to fix this problem hope it helps

"var bulletprefab : Transform;
var score = 0;
var spawn : Transform;
var neededscore = 10;
var scoreplus = 100000;

function Update(){

	if(score>neededscore-1)
	{
		var bullet = Instantiate(bulletprefab,
	 								spawn.transform.position, 
	 								Quaternion.identity);
	 	neededscore = neededscore + scoreplus;
	}

}"