using System;
using UnityEditor;
using UnityEngine;
namespace Framework.Dialogue {
/// Helps the user place dialogue in the scene
public static class DialoguePlacementTool {
/// Make the selected game object(s) point at the current view
[MenuItem("GameObject/Point at View")]
public static void PointAtView() {
GameObject activeGameObject = UnityEditor.Selection.activeGameObject;
if(activeGameObject != null) {
Camera sceneViewCamera = SceneView.lastActiveSceneView.camera;
if(sceneViewCamera != null) {
Vector3 targetPosition = (
activeGameObject.transform.position - sceneViewCamera.transform.position
);
targetPosition = sceneViewCamera.transform.position + (2.0f * targetPosition);
activeGameObject.transform.LookAt(targetPosition, sceneViewCamera.transform.up);
}
}
}
///
/// Make the selected game object(s) point at the current view and scale them so they
/// have a 1:1 pixel size seem from the view (assuming default FoV)
///
[MenuItem("GameObject/Point at View (Uniform Scale)")]
public static void PointAtViewAndScale() {
}
}
} // namespace Framework.Dialogue