- Home /
What is the name of the guistyle to draw the preview buttons?
Hi,
I have been working on some audio tools lately and I was wondering if anyone knew the gui style to create the play, loop and sound icon buttons in the upper right part of the preview panel.
Comment
Best Answer
Answer by Bunny83 · Aug 13, 2012 at 11:08 AM
Those buttons aren't part of any skin. They are loaded manually with an internal function:
AudioClipInspector.s_AutoPlayIcons[0] = EditorGUIUtility.IconContent("preAudioAutoPlayOff", "Turn Auto Play on");
AudioClipInspector.s_AutoPlayIcons[1] = EditorGUIUtility.IconContent("preAudioAutoPlayOn", "Turn Auto Play off");
AudioClipInspector.s_PlayIcons[0] = EditorGUIUtility.IconContent("preAudioPlayOff", "Play");
AudioClipInspector.s_PlayIcons[1] = EditorGUIUtility.IconContent("preAudioPlayOn", "Stop");
AudioClipInspector.s_LoopIcons[0] = EditorGUIUtility.IconContent("preAudioLoopOff", "Loop on");
AudioClipInspector.s_LoopIcons[1] = EditorGUIUtility.IconContent("preAudioLoopOn", "Loop off");
But the GUIContents are cached in a private static hashtable:
EditorGUIUtility.s_IconGUIContents;
You have to use reflection to access them.
edit
Of course they are only cached when they have been used by Unity before...
So the cache is not a save spot to get them.
This is the internal function that loads the image and put it in the cache. It also use the cache when it's already cached ;)
EditorGUIUtility.IconContent()
ILSpy is your friend ;)