private void InstantiateAudioSourceAndPlay(AudioClip clip) { AudioSource audioSource = Instantiate(AudioPrefab, transform.position, transform.rotation) as AudioSource; Headache audioSourceObject = audioSource.GetComponent <Headache>(); audioSource.clip = clip; audioSource.Play(); }
// unity awake void Awake() { // create the components m_waves = gameObject.AddComponent <Waves>(); m_headache = gameObject.AddComponent <Headache>(); m_coloredRays = gameObject.AddComponent <ColoredRays>(); m_lowResolution = gameObject.AddComponent <LowResolution>(); }