function input

not sure where i should post this or100% how everything should be said.

i just want to make a randomize function that other functions can use that passes something into the function.

	    void SpawnAi()
		{
	        if(spawnEnemy)
	        {	
				temp = spawners.GetComponent<SpawnEnemy>().SpawnRandomEnemy(); // Spawn a random enemy on the map
				randomizer(temp);							////////////////////////////////////////////////////////////////
	        }
	    }

			// KILL ENEMY BUTTON //
			if(GUI.Button(new Rect(Screen.width - 395, Screen.height - 105, 75,75),kill)) // If this button is pressed
			{
				temp = Destroy(FindNearestEnemy()); // Destroy game object, this call has a return of a game object, either found or null
				randomizer(temp);
			}

	void randomizer(gameObject temp){					////////////////////////////////////////////////////////////////
			int randNo = Random.Range(0,10);			////////////////////////////////////////////////////////////////
			Debug.Log("randNo: "+ randNo);				////////////////////////////////////////////////////////////////
			for(int i = 0; i < randNo; i++){			////////////////////////////////////////////////////////////////
				temp;									////////////////////////////////////////////////////////////////
			}											////////////////////////////////////////////////////////////////
	}													////////////////////////////////////////////////////////////////

not sure what should go in the gameObject place?

im more javascript and dont need to use types to do things.

First thing I noticed is in your randomizer method. **gameObject ** with small g is not a type, is a property. Types start with capitals so it should be:

void randomizer(GameObject temp)
{
      int randNo = Random.Range(0, 10);
      Debug.Log("randNo: " + randNo);
      for (int i = 0; i < randNo; i++)
      {
           temp;   // This command can't do anything by itself 
      }
}

But what are you trying to accomplish within the for loop?

Another option is to use Generic methods, but something tells me this is not what you’re looking for here.

// KILL ENEMY BUTTON //
if(GUI.Button(new Rect(Screen.width - 395, Screen.height - 105, 75,75),kill))
{
Destroy(FindNearestEnemy()); // i want to call this a random number of times
}

void SpawnAi()
{
	if(spawnEnemy)
	{	
		spawners.GetComponent<SpawnEnemy>().SpawnRandomEnemy();// i want to call this random number of times.						
	}
}

i was hoping to make a function that i can pass anything into it and it runs a random number of times.
i can easily do it like this

// KILL ENEMY BUTTON //
if(GUI.Button(new Rect(Screen.width - 395, Screen.height - 105, 75,75),kill))
{for(int i = 0; i < randNo; i++){
	Destroy(FindNearestEnemy()); // i want to call this a random number of times	}						
}

void SpawnAi()
{
	if(spawnEnemy)
	{	for(int i = 0; i < randNo; i++){
		spawners.GetComponent<SpawnEnemy>().SpawnRandomEnemy();// i want to call this random number of times.	}					
	}
}