CinemachineSameAsFollowTargetEditor.cs 928 B

123456789101112131415161718192021222324
  1. using UnityEditor;
  2. using UnityEngine;
  3. namespace Cinemachine.Editor
  4. {
  5. [CustomEditor(typeof(CinemachineSameAsFollowTarget))]
  6. [CanEditMultipleObjects]
  7. internal sealed class CinemachineSameAsFollowTargetEditor : BaseEditor<CinemachineSameAsFollowTarget>
  8. {
  9. public override void OnInspectorGUI()
  10. {
  11. BeginInspector();
  12. bool needWarning = false;
  13. for (int i = 0; !needWarning && i < targets.Length; ++i)
  14. needWarning = (targets[i] as CinemachineSameAsFollowTarget).FollowTarget == null;
  15. if (needWarning)
  16. EditorGUILayout.HelpBox(
  17. "Same As Follow Target requires a Follow target. It will set the virtual camera's "
  18. + "rotation to be the same as that of the Follow Target.",
  19. MessageType.Warning);
  20. DrawRemainingPropertiesInInspector();
  21. }
  22. }
  23. }