Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using UnityEngine;
- using System.Collections;
- [@ExecuteInEditMode()]
- public class LookAtPoint : MonoBehaviour {
- // LookAtPoint.cs
- // This Script has to be outside of the editor folder.
- //
- // Usage: Just Place this script on the object you want to work the handle with.
- public Vector3 lookAtPoint = Vector3.zero;
- void Update () {
- transform.LookAt (lookAtPoint);
- }
- }
- ____________________________________________________________
- using UnityEngine;
- using UnityEditor;
- [@CustomEditor (typeof(LookAtPoint))]
- class LookAtPointEditor : Editor {
- void OnSceneGUI () {
- LookAtPoint look = (LookAtPoint) target;
- look.lookAtPoint = Handles.PositionHandle (look.lookAtPoint, Quaternion.identity);
- if (GUI.changed)
- {
- EditorUtility.SetDirty (target);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment