Oh, I get it. Each integer is replaced with the entire Random.Range call, including the right?
Edit: Here I’m trying to get a Random.Range for X, with a specific Z and Y coordinate. But it doesn’t seem to be working. Right when I thought I understood the Random.Range…
void SpawnRedEnemy()
{
float addPos = (Random.Range(-250f, 250f), 0, 110);
Vector3 spawnPos = transform.position + new Vector3(addPos,0,0);
Instantiate(redEnemy, spawnPos, Quaternion.identity);
}
This was cut from an example project involving falling eggs and catching them into a bucket. Also, what do those "f"s mean?
Edit 2: Ah, I think I’ve figure it out.
void SpawnRedEnemy()
{
float addXPos = Random.Range(-250, 250);
Vector3 spawnPos = transform.position + new Vector3(addXPos,-10,105);
Instantiate(redEnemy, spawnPos, Quaternion.identity);
}
My question is, is this “float addXpos” needed? I have this attached to my camera and my enemies were Instantiated based off that. Should I be forcing a world coordinate or creating an empty object where I want the pivot points for enemy spawns?
Is there a multiplier you can add to Instantiate calls? For example:
Public float enemyMultiplier;
Instantiate(myPrefab) * enemyMultiplier;
Or something of that nature?