Skip to content

Instantly share code, notes, and snippets.

@s2kw
Last active December 17, 2016 12:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save s2kw/eab089b623dc37ce20abfc6641b67e6c to your computer and use it in GitHub Desktop.
Save s2kw/eab089b623dc37ce20abfc6641b67e6c to your computer and use it in GitHub Desktop.
DropDownMenu in Inspector for Unity3D
using UnityEditor;
[CustomEditor( typeof( SoundSystem ) )]
public class SoundSystemInspector : Editor{
int type;
public override void OnInspectorGUI()
{
DrawDefaultInspector();
var script = target as SoundSystem;
string[] strings = System.Enum.GetNames(typeof(SoundSystem.AudioType));
this.type = EditorGUILayout.Popup(type,strings );
if (GUILayout.Button("Play " + this.type))
{
script.PlaySound((SoundSystem.AudioType)this.type);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment