public override void OnInspectorGUI()
        {
            AudioItemSet       set   = (AudioItemSet)target;
            SerializedProperty items = serializedObject.FindProperty("audioItems");

            if (GUILayout.Button("Play Random Clip"))
            {
                if (items.arraySize <= 0)
                {
                    Debug.LogError("AudioItemSet has no AudioItems");
                    return;
                }
                Play(set.GetRandom());
            }

            if (GUILayout.Button("Play Next Clip"))
            {
                if (items.arraySize <= 0)
                {
                    Debug.LogError("AudioItemSet has no AudioItems");
                    return;
                }
                Play(set.GetNext());
            }

            serializedObject.Update();
            list.DoLayoutList();

            GUI.enabled = false;
            EditorGUILayout.LabelField("Weight Sum", serializedObject.FindProperty("weightSum").floatValue.ToString("F"));
            GUI.enabled = true;

            serializedObject.ApplyModifiedProperties();
        }
Beispiel #2
0
 public void PlayRandomClip()
 {
     Play(audioItemSet.GetRandom());
 }