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

Commit 76c77fb

Browse files
committed
Add button to inspect scene of a GameObject
1 parent a25017d commit 76c77fb

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

src/UI/Widgets/GameObjects/GameObjectInfoPanel.cs

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,8 @@ public class GameObjectInfoPanel
3333
Text ActiveSelfText;
3434
Toggle IsStaticToggle;
3535

36-
InputFieldRef SceneInput;
36+
ButtonRef SceneButton;
37+
3738
InputFieldRef InstanceIDInput;
3839
InputFieldRef TagInput;
3940

@@ -100,7 +101,7 @@ public void UpdateGameObjectInfo(bool firstUpdate, bool force)
100101
if (force || Target.scene.handle != lastSceneHandle)
101102
{
102103
lastSceneHandle = Target.scene.handle;
103-
SceneInput.Text = Target.scene.IsValid() ? Target.scene.name : "None (Asset/Resource)";
104+
SceneButton.ButtonText.text = Target.scene.IsValid() ? Target.scene.name : "None (Asset/Resource)";
104105
}
105106

106107
if (force || (!TagInput.Component.isFocused && Target.tag != lastTag))
@@ -228,6 +229,11 @@ void OnTagEndEdit(string value)
228229
ExplorerCore.LogWarning($"Exception setting tag! {ex.ReflectionExToString()}");
229230
}
230231
}
232+
233+
void OnSceneButtonClicked()
234+
{
235+
InspectorManager.Inspect(Target.scene);
236+
}
231237

232238
void OnExploreButtonClicked()
233239
{
@@ -383,10 +389,9 @@ public void Create()
383389
Text sceneLabel = UIFactory.CreateLabel(thirdrow, "SceneLabel", "Scene:", TextAnchor.MiddleLeft, Color.grey);
384390
UIFactory.SetLayoutElement(sceneLabel.gameObject, minHeight: 25, minWidth: 50);
385391

386-
SceneInput = UIFactory.CreateInputField(thirdrow, "SceneInput", "untitled");
387-
UIFactory.SetLayoutElement(SceneInput.Component.gameObject, minHeight: 25, minWidth: 120, flexibleWidth: 999);
388-
SceneInput.Component.readOnly = true;
389-
SceneInput.Component.textComponent.color = new Color(0.7f, 0.7f, 0.7f);
392+
SceneButton = UIFactory.CreateButton(thirdrow, "SceneButton", "untitled");
393+
UIFactory.SetLayoutElement(SceneButton.Component.gameObject, minHeight: 25, minWidth: 120, flexibleWidth: 999);
394+
SceneButton.OnClick += OnSceneButtonClicked;
390395

391396
// Layer
392397
Text layerLabel = UIFactory.CreateLabel(thirdrow, "LayerLabel", "Layer:", TextAnchor.MiddleLeft, Color.grey);

0 commit comments

Comments
 (0)