Instantiate the prefebd while count text increcreses its value

Hi all,

I have a score counter in my game I want to Instantiate a new gameobject while score was increased by 1

my code is

public static int score;
`void Update () {
		score = move.count;
		
		if(score>=spawnTime)
		/
		
			SpawnRandom();  
			
	}` ,
public void SpawnRandom()
	{
		
		
		direction = new Vector2 (-4.41f,1.99f);
		randomNumber = Random.Range (1, 3);
		switch (randomNumber) {
		case 1:
			 white= Instantiate(apple,direction,Quaternion.identity);
//			
			break;
		case 2:
			Instantiate(red,direction,Quaternion.identity);
				
			break;
}
}

Hi, create a new variable that you use to check if the score has changed, like this:

public static int score;
public int maxScore;

void Update ()
{
if (score > maxScore)
{
SpawnRandom();
maxScore = score;
}
}

Thanks for ur reply ,

if count is 0- show the one prefeb object randomly ,if count is 1 change the prefeb object and chose another one.

But in my game it is showing 10 objects at each case plz help me