Hi
I am am trying to create a mini game in C# where random notes drop from a piano and when the player collides with the notes a note is played.
I am haveing trouble on figuring out how to spawn random prefabs from the piano with a specific note attached, So far I am only able to spawn clones of the same prefab,
here is my attached code
using UnityEngine;
using System.Collections;
public class SpawnBoxes : MonoBehaviour
{
public Rigidbody box;
public bool readynow = true;
// Use this for initialization
void Start ()
{
}
// Update is called once per frame
void Update ()
{
if (readynow)
{
StartCoroutine(makeBox());
}
}
IEnumerator makeBox()
{
readynow = false;
Instantiate(box, transform.position, transform.rotation);
yield return new WaitForSeconds(1);
readynow = true;
}
}
Can anyone offer any advice on how to approach this problem
Thanks