From bb46d77a0287d5fc9f146c7d6531c4e2426ea2d7 Mon Sep 17 00:00:00 2001 From: sinaioutlander <49360850+sinaioutlander@users.noreply.github.com> Date: Sun, 22 Nov 2020 18:22:57 +1100 Subject: [PATCH] 3.0.3 * Fixed not being able to set values on Enums * [MONO] Fixed an issue where GameObjects in no scene (a Resource/Asset) would display nothing for their scene name, instead of "None (Resource/Asset)". * Some UI layout cleanups and fixes, the Child/Component lists on the GameObject inspector should now expand to fill available height. --- src/Inspectors/GameObjects/ChildList.cs | 2 +- src/Inspectors/GameObjects/ComponentList.cs | 3 +- .../GameObjects/GameObjectInspector.cs | 24 ++++-- src/Inspectors/InspectorManager.cs | 78 ------------------- .../InteractiveValue/InteractiveEnum.cs | 5 +- src/UI/ForceUnlockCursor.cs | 2 - src/UI/UIFactory.cs | 24 +++--- src/UnityExplorer.csproj | 2 +- 8 files changed, 36 insertions(+), 104 deletions(-) diff --git a/src/Inspectors/GameObjects/ChildList.cs b/src/Inspectors/GameObjects/ChildList.cs index 1d0d23a..d2710e9 100644 --- a/src/Inspectors/GameObjects/ChildList.cs +++ b/src/Inspectors/GameObjects/ChildList.cs @@ -140,7 +140,7 @@ namespace UnityExplorer.Inspectors.GameObjects { var vertGroupObj = UIFactory.CreateVerticalGroup(parent, new Color(1, 1, 1, 0)); var vertGroup = vertGroupObj.GetComponent(); - vertGroup.childForceExpandHeight = false; + vertGroup.childForceExpandHeight = true; vertGroup.childForceExpandWidth = false; vertGroup.childControlWidth = true; vertGroup.spacing = 5; diff --git a/src/Inspectors/GameObjects/ComponentList.cs b/src/Inspectors/GameObjects/ComponentList.cs index 555c5ae..892e694 100644 --- a/src/Inspectors/GameObjects/ComponentList.cs +++ b/src/Inspectors/GameObjects/ComponentList.cs @@ -136,7 +136,7 @@ namespace UnityExplorer.Inspectors.GameObjects { var vertGroupObj = UIFactory.CreateVerticalGroup(parent, new Color(1, 1, 1, 0)); var vertGroup = vertGroupObj.GetComponent(); - vertGroup.childForceExpandHeight = false; + vertGroup.childForceExpandHeight = true; vertGroup.childForceExpandWidth = false; vertGroup.childControlWidth = true; vertGroup.spacing = 5; @@ -157,6 +157,7 @@ namespace UnityExplorer.Inspectors.GameObjects var compScrollObj = UIFactory.CreateScrollView(vertGroupObj, out s_compListContent, out SliderScrollbar scroller, new Color(0.07f, 0.07f, 0.07f)); var contentLayout = compScrollObj.AddComponent(); contentLayout.minHeight = 50; + contentLayout.flexibleHeight = 5000; s_compListPageHandler = new PageHandler(scroller); s_compListPageHandler.ConstructUI(vertGroupObj); diff --git a/src/Inspectors/GameObjects/GameObjectInspector.cs b/src/Inspectors/GameObjects/GameObjectInspector.cs index 9658cb0..5a873ec 100644 --- a/src/Inspectors/GameObjects/GameObjectInspector.cs +++ b/src/Inspectors/GameObjects/GameObjectInspector.cs @@ -164,7 +164,7 @@ namespace UnityExplorer.Inspectors m_layerDropdown.value = TargetGO.layer; } - if (m_lastScene != TargetGO.scene.name) + if (string.IsNullOrEmpty(m_lastScene) || m_lastScene != TargetGO.scene.name) { m_lastScene = TargetGO.scene.name; @@ -217,10 +217,20 @@ namespace UnityExplorer.Inspectors s_content = UIFactory.CreateScrollView(parent, out GameObject scrollContent, out _, new Color(0.1f, 0.1f, 0.1f)); + var parentLayout = scrollContent.transform.parent.gameObject.AddComponent(); + parentLayout.childForceExpandWidth = true; + parentLayout.childControlWidth = true; + parentLayout.childForceExpandHeight = true; + parentLayout.childControlHeight = true; + var scrollGroup = scrollContent.GetComponent(); scrollGroup.childForceExpandHeight = true; scrollGroup.childControlHeight = true; + scrollGroup.childForceExpandWidth = true; + scrollGroup.childControlWidth = true; scrollGroup.spacing = 5; + var contentFitter = scrollContent.GetComponent(); + contentFitter.verticalFit = ContentSizeFitter.FitMode.Unconstrained; ConstructTopArea(scrollContent); @@ -230,6 +240,9 @@ namespace UnityExplorer.Inspectors s_childList.ConstructChildList(midGroupObj); s_compList.ConstructCompList(midGroupObj); + + LayoutRebuilder.ForceRebuildLayoutImmediate(s_content.GetComponent()); + Canvas.ForceUpdateCanvases(); } private void ConstructTopArea(GameObject scrollContent) @@ -431,11 +444,10 @@ namespace UnityExplorer.Inspectors midGroup.childControlWidth = true; midGroup.childForceExpandHeight = true; midGroup.childControlHeight = true; - var midlayout = midGroupObj.AddComponent(); - midlayout.minHeight = 350; - midlayout.flexibleHeight = 10000; - midlayout.minWidth = 200; - midlayout.flexibleWidth = 25000; + + var midLayout = midGroupObj.AddComponent(); + midLayout.minHeight = 300; + midLayout.flexibleHeight = 5000; return midGroupObj; } diff --git a/src/Inspectors/InspectorManager.cs b/src/Inspectors/InspectorManager.cs index c1261b9..999b094 100644 --- a/src/Inspectors/InspectorManager.cs +++ b/src/Inspectors/InspectorManager.cs @@ -230,84 +230,6 @@ namespace UnityExplorer.Inspectors invisGroup.padding.right = 2; invisGroup.spacing = 10; -// // time scale group - -// var timeGroupObj = UIFactory.CreateHorizontalGroup(invisObj, new Color(1, 1, 1, 0)); -// var timeGroup = timeGroupObj.GetComponent(); -// timeGroup.childForceExpandWidth = false; -// timeGroup.childControlWidth = true; -// timeGroup.childForceExpandHeight = false; -// timeGroup.childControlHeight = true; -// timeGroup.padding.top = 2; -// timeGroup.padding.left = 5; -// timeGroup.padding.right = 2; -// timeGroup.padding.bottom = 2; -// timeGroup.spacing = 5; -// timeGroup.childAlignment = TextAnchor.MiddleCenter; -// var timeGroupLayout = timeGroupObj.AddComponent(); -// timeGroupLayout.minWidth = 100; -// timeGroupLayout.flexibleWidth = 300; -// timeGroupLayout.minHeight = 25; -// timeGroupLayout.flexibleHeight = 0; - -// // time scale title - -// var timeTitleObj = UIFactory.CreateLabel(timeGroupObj, TextAnchor.MiddleLeft); -// var timeTitle = timeTitleObj.GetComponent(); -// timeTitle.text = "Time Scale:"; -// timeTitle.color = new Color(21f / 255f, 192f / 255f, 235f / 255f); -// var titleLayout = timeTitleObj.AddComponent(); -// titleLayout.minHeight = 25; -// titleLayout.minWidth = 80; -// titleLayout.flexibleHeight = 0; -// timeTitle.horizontalOverflow = HorizontalWrapMode.Overflow; - -// // actual active time label - -// var timeLabelObj = UIFactory.CreateLabel(timeGroupObj, TextAnchor.MiddleLeft); -// var timeLabelLayout = timeLabelObj.AddComponent(); -// timeLabelLayout.minWidth = 40; -// timeLabelLayout.minHeight = 25; -// timeLabelLayout.flexibleHeight = 0; - -// // todo make static and update -// var s_timeText = timeLabelObj.GetComponent(); -// s_timeText.text = Time.timeScale.ToString("F1"); - -// // time scale input - -// var timeInputObj = UIFactory.CreateInputField(timeGroupObj); -// var timeInput = timeInputObj.GetComponent(); -// timeInput.characterValidation = InputField.CharacterValidation.Decimal; -// var timeInputLayout = timeInputObj.AddComponent(); -// timeInputLayout.minWidth = 90; -// timeInputLayout.flexibleWidth = 0; -// timeInputLayout.minHeight = 25; -// timeInputLayout.flexibleHeight = 0; - -// // time scale apply button - -// var applyBtnObj = UIFactory.CreateButton(timeGroupObj); -// var applyBtn = applyBtnObj.GetComponent