using System.Collections; using System.Collections.Generic; using UnityEngine; public class Sounds : MonoBehaviour { public List clips; public static void PlaySound(int i) { GameObject go = new GameObject(); var source = go.AddComponent(); source.clip = FindObjectOfType().clips[i]; source.volume = 1f; source.loop = false; source.playOnAwake = false; source.Play(); } }