Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion ConfigurationManager.Shared/ConfigurationManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,7 @@ private static void DrawTooltip(Rect area)
string tooltip = GUI.tooltip;
if (!string.IsNullOrEmpty(tooltip))
{
var style = new GUIStyle(GUI.skin.box);
var style = GUI.skin.box.CreateCopy();
style.wordWrap = true;
style.alignment = TextAnchor.MiddleCenter;

Expand Down
24 changes: 10 additions & 14 deletions ConfigurationManager.Shared/SettingFieldDrawer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -97,13 +97,11 @@ public static void DrawCategoryHeader(string text)
{
if (_categoryHeaderSkin == null)
{
_categoryHeaderSkin = new GUIStyle(GUI.skin.label)
{
alignment = TextAnchor.UpperCenter,
wordWrap = true,
stretchWidth = true,
fontSize = 14
};
_categoryHeaderSkin = GUI.skin.label.CreateCopy();
_categoryHeaderSkin.alignment = TextAnchor.UpperCenter;
_categoryHeaderSkin.wordWrap = true;
_categoryHeaderSkin.stretchWidth = true;
_categoryHeaderSkin.fontSize = 14;
}

GUILayout.Label(text, _categoryHeaderSkin);
Expand All @@ -114,13 +112,11 @@ public static bool DrawPluginHeader(GUIContent content, bool isCollapsed)
{
if (_pluginHeaderSkin == null)
{
_pluginHeaderSkin = new GUIStyle(GUI.skin.label)
{
alignment = TextAnchor.UpperCenter,
wordWrap = true,
stretchWidth = true,
fontSize = 15
};
_pluginHeaderSkin = GUI.skin.label.CreateCopy();
_pluginHeaderSkin.alignment = TextAnchor.UpperCenter;
_pluginHeaderSkin.wordWrap = true;
_pluginHeaderSkin.stretchWidth = true;
_pluginHeaderSkin.fontSize = 15;
}

if (isCollapsed) content.text += "\n...";
Expand Down
12 changes: 12 additions & 0 deletions ConfigurationManager.Shared/Utilities/Utilities.cs
Original file line number Diff line number Diff line change
Expand Up @@ -180,5 +180,17 @@ public static void OpenWebsite(string url)
ConfigurationManager.Logger.Log(LogLevel.Message | LogLevel.Warning, $"Failed to open URL {url}\nCause: {ex.Message}");
}
}

public static GUIStyle CreateCopy(this GUIStyle original)
{
#if IL2CPP
// Copy constructor is sometimes stripped out in IL2CPP
var guiStyle = new GUIStyle();
guiStyle.m_Ptr = GUIStyle.Internal_Copy(guiStyle, original);
return guiStyle;
#else
return new GUIStyle(original);
#endif
}
}
}