Skip to content

Commit d8f9490

Browse files
committed
Proper GUI style handling
1 parent 8d0b7c0 commit d8f9490

File tree

1 file changed

+2
-7
lines changed

1 file changed

+2
-7
lines changed

moduleManager.cs

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -481,25 +481,20 @@ public void Update()
481481
static string status = "Processing Module Manager patch\nPlease Wait...";
482482
static string errors = "";
483483

484-
GUISkin mmSkin;
485-
486484
public void OnGUI()
487485
{
488486
if (HighLogic.LoadedScene != GameScenes.LOADING)
489487
return;
490488

491-
if (mmSkin == null)
492-
mmSkin = (GUISkin)GameObject.Instantiate(GUI.skin);
493-
494-
var centeredStyle = mmSkin.GetStyle("Label");
489+
var centeredStyle = new GUIStyle(GUI.skin.GetStyle("Label"));
495490
centeredStyle.alignment = TextAnchor.UpperCenter;
496491
centeredStyle.fontSize = 16;
497492
Vector2 sizeOfLabel = centeredStyle.CalcSize(new GUIContent(status));
498493
GUI.Label(new Rect(Screen.width / 2 - (sizeOfLabel.x / 2), Mathf.FloorToInt(0.8f * Screen.height), sizeOfLabel.x, sizeOfLabel.y), status, centeredStyle);
499494

500495
if (errorCount > 0)
501496
{
502-
var errorStyle = mmSkin.GetStyle("Label");
497+
var errorStyle = new GUIStyle(GUI.skin.GetStyle("Label"));
503498
errorStyle.alignment = TextAnchor.UpperLeft;
504499
errorStyle.fontSize = 16;
505500
Vector2 sizeOfError = errorStyle.CalcSize(new GUIContent(errors));

0 commit comments

Comments
 (0)