/// <summary> /// Draw the GUI buttons /// </summary> void OnGUI() { yPos = 0; // Reset the button Y position #region Salsa2D Play, Pause, and Stop controls yPos += yGap; if (GUI.Button(new Rect(20, yPos, xWidth, yHeight), "Play")) { salsa2D.Play(); // Salsa3D Play method } yPos += (yGap + yHeight); if (GUI.Button(new Rect(20, yPos, xWidth, yHeight), "Pause")) { salsa2D.Pause(); // Salsa3D Pause method } yPos += (yGap + yHeight); if (GUI.Button(new Rect(20, yPos, xWidth, yHeight), "Stop")) { salsa2D.Stop(); // Salsa3D Stop method } #endregion #region Toggle which audio clip is set on Salsa2D yPos += (yGap + yHeight); if (GUI.Button(new Rect(20, yPos, xWidth, yHeight), "Set audio clip")) { if (clipIndex < audioClips.Length - 1) { clipIndex++; salsa2D.SetAudioClip(audioClips[clipIndex]); } else { clipIndex = 0; salsa2D.SetAudioClip(audioClips[clipIndex]); } } #endregion #region Display the currently selected audio clip GUI.Label(new Rect(30 + xWidth, yPos, xWidth, yHeight), "Clip " + audioClips[clipIndex].name); #endregion }