- Home /
Is possible to use EditorStyle on Unity in-game to do Horizontal Groups of Buttons?
I want to use EditorStyles on an in-game situation. I inspected EditorStyles class, and I realize that everything comes from:
private GUIStyle GetStyle(string styleName)
{
GUIStyle s = GUI.skin.FindStyle(styleName) ?? EditorGUIUtility.GetBuiltinSkin(EditorSkin.Inspector).FindStyle(styleName);
if (s == null)
{
Debug.LogError("Missing built-in guistyle " + styleName);
s = GUISkin.error;
}
return s;
}
Copied from: https://github.com/Unity-Technologies/UnityCsReference/blob/master/Editor/Mono/GUI/EditorStyles.cs#L425
The reference call is here: https://github.com/Unity-Technologies/UnityCsReference/blob/master/Editor/Mono/GUI/EditorStyles.cs#L333
And this is what I use (on Editor): https://github.com/Unity-Technologies/UnityCsReference/blob/master/Editor/Mono/GUI/EditorStyles.cs#L71
All this to do the following:
Extracted from: https://answers.unity.com/questions/675080/how-can-i-create-a-button-group-like-selectreverta.html
I have to do the following:
EditorGUILayout.BeginHorizontal ();
if (GUILayout.Button ("Select", EditorStyles.miniButtonLeft)) {
}
if (GUILayout.Button ("Revert", EditorStyles.miniButton)) {
}
if (GUILayout.Button ("Apply", EditorStyles.miniButtonRight)) {
}
EditorGUILayout.EndHorizontal ();
But, I want to know if there is any possible way to do this in-game. Is this possible?
Your answer
Follow this Question
Related Questions
Multiple Cars not working 1 Answer
Distribute terrain in zones 3 Answers
In-Game scripting works in Editor (Try it!) - But Not Build 3 Answers
EditorGUILayout for GUIStyle 0 Answers
Popup options not changing in custom editor script 0 Answers