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:
@ -214,7 +214,7 @@ namespace UnityExplorer.UI.Panels
|
|||||||
UIFactory.SetLayoutElement(fourthRow, minHeight: 25, flexibleWidth: 9999);
|
UIFactory.SetLayoutElement(fourthRow, minHeight: 25, flexibleWidth: 9999);
|
||||||
|
|
||||||
saveLoadInputField = UIFactory.CreateInputField(fourthRow, "PathName", "File name");
|
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);
|
GameObject spacer1 = UIFactory.CreateUIObject("Spacer", fourthRow);
|
||||||
LayoutElement spaceLayout1 = UIFactory.SetLayoutElement(spacer1, minWidth: 20, flexibleWidth: 0);
|
LayoutElement spaceLayout1 = UIFactory.SetLayoutElement(spacer1, minWidth: 20, flexibleWidth: 0);
|
||||||
|
@ -324,6 +324,19 @@ namespace UnityExplorer.UI.Widgets
|
|||||||
NameInput.Component.textComponent.fontSize = 15;
|
NameInput.Component.textComponent.fontSize = 15;
|
||||||
NameInput.Component.GetOnEndEdit().AddListener((string val) => { OnNameEndEdit(val); });
|
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)
|
// second row (toggles, instanceID, tag, buttons)
|
||||||
|
|
||||||
GameObject secondRow = UIFactory.CreateUIObject("ParentRow", topInfoHolder);
|
GameObject secondRow = UIFactory.CreateUIObject("ParentRow", topInfoHolder);
|
||||||
|
Reference in New Issue
Block a user