1
0
mirror of https://github.com/originalnicodr/CinematicUnityExplorer.git synced 2025-07-18 17:38:01 +08:00

Added a button in the game object inspector panel to move the object to the camera position (and rotation). Also minor UI adjustment on the CamPaths panel.

This commit is contained in:
originalnicodr
2024-11-25 19:18:37 -03:00
parent 7ab907d7b0
commit f3b154658c
2 changed files with 14 additions and 1 deletions

View File

@ -214,7 +214,7 @@ namespace UnityExplorer.UI.Panels
UIFactory.SetLayoutElement(fourthRow, minHeight: 25, flexibleWidth: 9999);
saveLoadInputField = UIFactory.CreateInputField(fourthRow, "PathName", "File name");
UIFactory.SetLayoutElement(saveLoadInputField.GameObject, minWidth: 330, minHeight: 25);
UIFactory.SetLayoutElement(saveLoadInputField.GameObject, minWidth: 320, minHeight: 25);
GameObject spacer1 = UIFactory.CreateUIObject("Spacer", fourthRow);
LayoutElement spaceLayout1 = UIFactory.SetLayoutElement(spacer1, minWidth: 20, flexibleWidth: 0);

View File

@ -324,6 +324,19 @@ namespace UnityExplorer.UI.Widgets
NameInput.Component.textComponent.fontSize = 15;
NameInput.Component.GetOnEndEdit().AddListener((string val) => { OnNameEndEdit(val); });
ButtonRef MoveToCameraButton = UIFactory.CreateButton(titleRow, "MoveToCameraButton", "Move to Camera", new Color(0.2f, 0.2f, 0.2f));
MoveToCameraButton.ButtonText.fontSize = 13;
UIFactory.SetLayoutElement(MoveToCameraButton.Component.gameObject, minHeight: 25, minWidth: 120);
MoveToCameraButton.OnClick += () => {
if (FreeCamPanel.inFreeCamMode) {
Transform freecamTransform = FreeCamPanel.GetFreecam().transform;
this.Target.gameObject.transform.position = freecamTransform.position;
this.Target.gameObject.transform.rotation = freecamTransform.rotation;
} else {
ExplorerCore.LogWarning("Enable freecam before trying to move an object to the camera!");
}
};
// second row (toggles, instanceID, tag, buttons)
GameObject secondRow = UIFactory.CreateUIObject("ParentRow", topInfoHolder);