I wrote some code to spawn coins every 20 seconds but it spawns just 1. I'd like to make spawn coins from 1 to 4 coins randomly. Here's what I have currently:

I found a solution for this script I made 4 prefabs with different coins 1,2,3 and 4 and this script work perfectly.

Thanks to all for answers.

```
using UnityEngine;
using System.Collections;

public class CoinSpaws : MonoBehaviour
{

    public GameObject[] coins;
    int coinNo;
    public float maxPos = 1.7f;
    public float delayTimer;
    float timer;

    // Use this for initialization
    void Start()
    {

        timer = delayTimer;

    }

    // Update is called once per frame
    void Update()
    {

        timer -= Time.deltaTime;
        if (timer <= 0)
        {

            Vector3 coinPos = new Vector3(Random.Range(-1.7f, 1.7f), transform.position.y, transform.position.z);
            coinNo = Random.Range(0, 4);
            Instantiate(coins[coinNo], coinPos, transform.rotation);
            timer = delayTimer;

        }

    }
}

```