- Home /
Question by
kittureddy425 · Apr 10, 2013 at 03:40 AM ·
c#
The below audioclips contains null so how to solve?
the below code comes null so could you plz tell me what i can do plz help me...
using UnityEngine; using System.Collections;
public class Audio_RanGen : MonoBehaviour { public AudioClip[] sounds;
// Use this for initialization
void Start ()
{
sounds=new AudioClip[5];
}
// Update is called once per frame
void Update ()
{
}
void OnGUI()
{
if(GUI.Button(new Rect(100,200,200,50),"Random Number Genaration"))
{
// sounds[Random.Range(0.0f, 4.0f)].Play();
audio.clip=sounds[(int)Random.Range(0,4)];
print (audio.clip);
audio.Play();
}
}
}
Comment
Your answer
Follow this Question
Related Questions
Multiple Cars not working 1 Answer
Distribute terrain in zones 3 Answers
turn on off particle system 1 Answer
Changing Axis to Buttons 2 Answers
Problem with C# "if" statement? 2 Answers