diff --git a/BeatSaberMarkupLanguage/ViewControllers/BSMLViewController.cs b/BeatSaberMarkupLanguage/ViewControllers/BSMLViewController.cs index c1419613..53ee351a 100644 --- a/BeatSaberMarkupLanguage/ViewControllers/BSMLViewController.cs +++ b/BeatSaberMarkupLanguage/ViewControllers/BSMLViewController.cs @@ -30,6 +30,15 @@ public abstract class BSMLViewController : ViewController, INotifyPropertyChange protected internal void ClearContents() { Destroy(contentObject); + + contentObject = new GameObject("Contents"); + contentObject.transform.SetParent(transform, false); + + RectTransform rectTransform = contentObject.AddComponent(); + rectTransform.anchorMin = Vector2.zero; + rectTransform.anchorMax = Vector2.one; + rectTransform.sizeDelta = Vector2.zero; + rectTransform.anchoredPosition = Vector2.zero; } protected override void DidActivate(bool firstActivation, bool addedToHierarchy, bool screenSystemEnabling) @@ -65,15 +74,6 @@ protected void ParseWithFallback() ClearContents(); - contentObject = new GameObject("Contents"); - contentObject.transform.SetParent(transform, false); - - RectTransform rectTransform = contentObject.AddComponent(); - rectTransform.anchorMin = Vector2.zero; - rectTransform.anchorMax = Vector2.one; - rectTransform.sizeDelta = Vector2.zero; - rectTransform.anchoredPosition = Vector2.zero; - try { BSMLParser.instance.Parse(Content, contentObject, this);