I am trying to spawn birds with a random scale which works but I can only scale the x y and z individual and not the xyz at the same time (with the same random value)
this is my script:
using UnityEngine;
using System.Collections;
public class BirdScript : MonoBehaviour
{
public float wait;
public GameObject Bird;
public Vector3 spawnValues;
void Start ()
{
StartCoroutine ( spawnBirds() );
}
IEnumerator spawnBirds()
{
for(int i = 0 ; i < 2 ; i++)
{
Vector3 spawnPosition = new Vector3 (spawnValues.x ,Random.Range (8f, 25f) , spawnValues.z);
Instantiate (Bird, spawnPosition , Quaternion.identity);
Vector3 scale = Bird.transform.localScale;
scale.x = Random.Range (1f, 5f);
Bird.transform.localScale = scale;
i = 0;
yield return new WaitForSeconds (wait);
}
}
}
any help would be greatly appreciated.