I want to spawn amount of objects when I press a button. what happing with me is giving only one object. I need random of objects. example when i press X it gives 1,2, 0 or 3 objects.
public GameObject[] diamons; // 3 objects
void Update ()
{
Vector3 place = transform.position;
if (Input.GetKeyDown(KeyCode.X))
{
int diamons_Num = Random.Range(0,3);
Instantiate(diamons[diamons_Num], place, Quaternion.identity);
Debug.Log (" .:. Surprice .:.");
}
} // end update