Skip to content
This repository was archived by the owner on May 9, 2023. It is now read-only.

Commit bb46d77

Browse files
committed
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.
1 parent c38155a commit bb46d77

File tree

8 files changed

+36
-104
lines changed

8 files changed

+36
-104
lines changed

src/Inspectors/GameObjects/ChildList.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ internal void ConstructChildList(GameObject parent)
140140
{
141141
var vertGroupObj = UIFactory.CreateVerticalGroup(parent, new Color(1, 1, 1, 0));
142142
var vertGroup = vertGroupObj.GetComponent<VerticalLayoutGroup>();
143-
vertGroup.childForceExpandHeight = false;
143+
vertGroup.childForceExpandHeight = true;
144144
vertGroup.childForceExpandWidth = false;
145145
vertGroup.childControlWidth = true;
146146
vertGroup.spacing = 5;

src/Inspectors/GameObjects/ComponentList.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ internal void ConstructCompList(GameObject parent)
136136
{
137137
var vertGroupObj = UIFactory.CreateVerticalGroup(parent, new Color(1, 1, 1, 0));
138138
var vertGroup = vertGroupObj.GetComponent<VerticalLayoutGroup>();
139-
vertGroup.childForceExpandHeight = false;
139+
vertGroup.childForceExpandHeight = true;
140140
vertGroup.childForceExpandWidth = false;
141141
vertGroup.childControlWidth = true;
142142
vertGroup.spacing = 5;
@@ -157,6 +157,7 @@ internal void ConstructCompList(GameObject parent)
157157
var compScrollObj = UIFactory.CreateScrollView(vertGroupObj, out s_compListContent, out SliderScrollbar scroller, new Color(0.07f, 0.07f, 0.07f));
158158
var contentLayout = compScrollObj.AddComponent<LayoutElement>();
159159
contentLayout.minHeight = 50;
160+
contentLayout.flexibleHeight = 5000;
160161

161162
s_compListPageHandler = new PageHandler(scroller);
162163
s_compListPageHandler.ConstructUI(vertGroupObj);

src/Inspectors/GameObjects/GameObjectInspector.cs

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ private void RefreshTopInfo()
164164
m_layerDropdown.value = TargetGO.layer;
165165
}
166166

167-
if (m_lastScene != TargetGO.scene.name)
167+
if (string.IsNullOrEmpty(m_lastScene) || m_lastScene != TargetGO.scene.name)
168168
{
169169
m_lastScene = TargetGO.scene.name;
170170

@@ -217,10 +217,20 @@ private void ConstructUI()
217217

218218
s_content = UIFactory.CreateScrollView(parent, out GameObject scrollContent, out _, new Color(0.1f, 0.1f, 0.1f));
219219

220+
var parentLayout = scrollContent.transform.parent.gameObject.AddComponent<VerticalLayoutGroup>();
221+
parentLayout.childForceExpandWidth = true;
222+
parentLayout.childControlWidth = true;
223+
parentLayout.childForceExpandHeight = true;
224+
parentLayout.childControlHeight = true;
225+
220226
var scrollGroup = scrollContent.GetComponent<VerticalLayoutGroup>();
221227
scrollGroup.childForceExpandHeight = true;
222228
scrollGroup.childControlHeight = true;
229+
scrollGroup.childForceExpandWidth = true;
230+
scrollGroup.childControlWidth = true;
223231
scrollGroup.spacing = 5;
232+
var contentFitter = scrollContent.GetComponent<ContentSizeFitter>();
233+
contentFitter.verticalFit = ContentSizeFitter.FitMode.Unconstrained;
224234

225235
ConstructTopArea(scrollContent);
226236

@@ -230,6 +240,9 @@ private void ConstructUI()
230240

231241
s_childList.ConstructChildList(midGroupObj);
232242
s_compList.ConstructCompList(midGroupObj);
243+
244+
LayoutRebuilder.ForceRebuildLayoutImmediate(s_content.GetComponent<RectTransform>());
245+
Canvas.ForceUpdateCanvases();
233246
}
234247

235248
private void ConstructTopArea(GameObject scrollContent)
@@ -431,11 +444,10 @@ private GameObject ConstructMidGroup(GameObject parent)
431444
midGroup.childControlWidth = true;
432445
midGroup.childForceExpandHeight = true;
433446
midGroup.childControlHeight = true;
434-
var midlayout = midGroupObj.AddComponent<LayoutElement>();
435-
midlayout.minHeight = 350;
436-
midlayout.flexibleHeight = 10000;
437-
midlayout.minWidth = 200;
438-
midlayout.flexibleWidth = 25000;
447+
448+
var midLayout = midGroupObj.AddComponent<LayoutElement>();
449+
midLayout.minHeight = 300;
450+
midLayout.flexibleHeight = 5000;
439451

440452
return midGroupObj;
441453
}

src/Inspectors/InspectorManager.cs

Lines changed: 0 additions & 78 deletions
Original file line numberDiff line numberDiff line change
@@ -230,84 +230,6 @@ private static void ConstructToolbar(GameObject topRowObj)
230230
invisGroup.padding.right = 2;
231231
invisGroup.spacing = 10;
232232

233-
// // time scale group
234-
235-
// var timeGroupObj = UIFactory.CreateHorizontalGroup(invisObj, new Color(1, 1, 1, 0));
236-
// var timeGroup = timeGroupObj.GetComponent<HorizontalLayoutGroup>();
237-
// timeGroup.childForceExpandWidth = false;
238-
// timeGroup.childControlWidth = true;
239-
// timeGroup.childForceExpandHeight = false;
240-
// timeGroup.childControlHeight = true;
241-
// timeGroup.padding.top = 2;
242-
// timeGroup.padding.left = 5;
243-
// timeGroup.padding.right = 2;
244-
// timeGroup.padding.bottom = 2;
245-
// timeGroup.spacing = 5;
246-
// timeGroup.childAlignment = TextAnchor.MiddleCenter;
247-
// var timeGroupLayout = timeGroupObj.AddComponent<LayoutElement>();
248-
// timeGroupLayout.minWidth = 100;
249-
// timeGroupLayout.flexibleWidth = 300;
250-
// timeGroupLayout.minHeight = 25;
251-
// timeGroupLayout.flexibleHeight = 0;
252-
253-
// // time scale title
254-
255-
// var timeTitleObj = UIFactory.CreateLabel(timeGroupObj, TextAnchor.MiddleLeft);
256-
// var timeTitle = timeTitleObj.GetComponent<Text>();
257-
// timeTitle.text = "Time Scale:";
258-
// timeTitle.color = new Color(21f / 255f, 192f / 255f, 235f / 255f);
259-
// var titleLayout = timeTitleObj.AddComponent<LayoutElement>();
260-
// titleLayout.minHeight = 25;
261-
// titleLayout.minWidth = 80;
262-
// titleLayout.flexibleHeight = 0;
263-
// timeTitle.horizontalOverflow = HorizontalWrapMode.Overflow;
264-
265-
// // actual active time label
266-
267-
// var timeLabelObj = UIFactory.CreateLabel(timeGroupObj, TextAnchor.MiddleLeft);
268-
// var timeLabelLayout = timeLabelObj.AddComponent<LayoutElement>();
269-
// timeLabelLayout.minWidth = 40;
270-
// timeLabelLayout.minHeight = 25;
271-
// timeLabelLayout.flexibleHeight = 0;
272-
273-
// // todo make static and update
274-
// var s_timeText = timeLabelObj.GetComponent<Text>();
275-
// s_timeText.text = Time.timeScale.ToString("F1");
276-
277-
// // time scale input
278-
279-
// var timeInputObj = UIFactory.CreateInputField(timeGroupObj);
280-
// var timeInput = timeInputObj.GetComponent<InputField>();
281-
// timeInput.characterValidation = InputField.CharacterValidation.Decimal;
282-
// var timeInputLayout = timeInputObj.AddComponent<LayoutElement>();
283-
// timeInputLayout.minWidth = 90;
284-
// timeInputLayout.flexibleWidth = 0;
285-
// timeInputLayout.minHeight = 25;
286-
// timeInputLayout.flexibleHeight = 0;
287-
288-
// // time scale apply button
289-
290-
// var applyBtnObj = UIFactory.CreateButton(timeGroupObj);
291-
// var applyBtn = applyBtnObj.GetComponent<Button>();
292-
293-
// applyBtn.onClick.AddListener(SetTimeScale);
294-
295-
// var applyText = applyBtnObj.GetComponentInChildren<Text>();
296-
// applyText.text = "Apply";
297-
// applyText.fontSize = 14;
298-
// var applyLayout = applyBtnObj.AddComponent<LayoutElement>();
299-
// applyLayout.minWidth = 50;
300-
// applyLayout.minHeight = 25;
301-
// applyLayout.flexibleHeight = 0;
302-
303-
// void SetTimeScale()
304-
// {
305-
// var scale = float.Parse(timeInput.text);
306-
// Time.timeScale = scale;
307-
// s_timeText.text = Time.timeScale.ToString("F1");
308-
// }
309-
310-
311233
// inspect under mouse button
312234

313235
var inspectObj = UIFactory.CreateButton(topRowObj);

src/Inspectors/Reflection/InteractiveValue/InteractiveEnum.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,10 @@ internal override void OnToggleSubcontent(bool toggle)
9696
private void SetValueFromDropdown()
9797
{
9898
var type = Value?.GetType() ?? FallbackType;
99-
var value = Enum.Parse(type, m_dropdownText.text);
99+
var index = m_dropdown.value;
100+
101+
var value = Enum.Parse(type, s_enumNamesCache[type][index].Value);
102+
100103
if (value != null)
101104
{
102105
Value = value;

src/UI/ForceUnlockCursor.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,6 @@ private static void SetupPatches()
6363
throw new Exception("Could not find Type 'UnityEngine.Cursor'!");
6464
}
6565

66-
ExplorerCore.Log("setting up forceunlockcursor patches...");
67-
6866
// Get current cursor state and enable cursor
6967
try
7068
{

src/UI/UIFactory.cs

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -178,13 +178,9 @@ public static GameObject CreateHorizontalGroup(GameObject parent, Color color =
178178

179179
Image image = groupObj.AddComponent<Image>();
180180
if (color != default)
181-
{
182181
image.color = color;
183-
}
184182
else
185-
{
186183
image.color = new Color(44f / 255f, 44f / 255f, 44f / 255f);
187-
}
188184

189185
return groupObj;
190186
}
@@ -657,16 +653,16 @@ public static GameObject CreateScrollView(GameObject parent, out GameObject cont
657653
contentFitter.horizontalFit = ContentSizeFitter.FitMode.Unconstrained;
658654
contentFitter.verticalFit = ContentSizeFitter.FitMode.PreferredSize;
659655

660-
var contentLayout = content.AddComponent<VerticalLayoutGroup>();
661-
contentLayout.childForceExpandHeight = true;
662-
contentLayout.childControlHeight = true;
663-
contentLayout.childForceExpandWidth = true;
664-
contentLayout.childControlWidth = true;
665-
contentLayout.padding.left = 5;
666-
contentLayout.padding.right = 5;
667-
contentLayout.padding.top = 5;
668-
contentLayout.padding.bottom = 5;
669-
contentLayout.spacing = 5;
656+
var contentGroup = content.AddComponent<VerticalLayoutGroup>();
657+
contentGroup.childForceExpandHeight = true;
658+
contentGroup.childControlHeight = true;
659+
contentGroup.childForceExpandWidth = true;
660+
contentGroup.childControlWidth = true;
661+
contentGroup.padding.left = 5;
662+
contentGroup.padding.right = 5;
663+
contentGroup.padding.top = 5;
664+
contentGroup.padding.bottom = 5;
665+
contentGroup.spacing = 5;
670666

671667
GameObject scrollBarObj = CreateUIObject("DynamicScrollbar", mainObj);
672668

src/UnityExplorer.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
<Prefer32Bit>false</Prefer32Bit>
2626
<RootNamespace>UnityExplorer</RootNamespace>
2727
<!-- Set this to the BepInEx Il2Cpp Game folder, without the ending '\' character. -->
28-
<BIECppGameFolder>D:\Steam\steamapps\common\Outward_IL2CPP</BIECppGameFolder>
28+
<BIECppGameFolder>D:\Steam\steamapps\common\Outward</BIECppGameFolder>
2929
<!-- Set this to the BepInEx Mono Game folder, without the ending '\' character. -->
3030
<BIEMonoGameFolder>D:\source\Unity Projects\Test\_BUILD_MONO</BIEMonoGameFolder>
3131
<!-- Set this to the BepInEx Mono Managed folder, without the ending '\' character. -->

0 commit comments

Comments
 (0)