summaryrefslogtreecommitdiff
path: root/Other/AstarPathfindingDemo/Packages/com.arongranberg.astar/Drawing/MonoBehaviourGizmos.cs
diff options
context:
space:
mode:
authorchai <215380520@qq.com>2024-05-23 10:08:29 +0800
committerchai <215380520@qq.com>2024-05-23 10:08:29 +0800
commit8722a9920c1f6119bf6e769cba270e63097f8e25 (patch)
tree2eaf9865de7fb1404546de4a4296553d8f68cc3b /Other/AstarPathfindingDemo/Packages/com.arongranberg.astar/Drawing/MonoBehaviourGizmos.cs
parent3ba4020b69e5971bb0df7ee08b31d10ea4d01937 (diff)
+ astar project
Diffstat (limited to 'Other/AstarPathfindingDemo/Packages/com.arongranberg.astar/Drawing/MonoBehaviourGizmos.cs')
-rw-r--r--Other/AstarPathfindingDemo/Packages/com.arongranberg.astar/Drawing/MonoBehaviourGizmos.cs40
1 files changed, 40 insertions, 0 deletions
diff --git a/Other/AstarPathfindingDemo/Packages/com.arongranberg.astar/Drawing/MonoBehaviourGizmos.cs b/Other/AstarPathfindingDemo/Packages/com.arongranberg.astar/Drawing/MonoBehaviourGizmos.cs
new file mode 100644
index 0000000..5019118
--- /dev/null
+++ b/Other/AstarPathfindingDemo/Packages/com.arongranberg.astar/Drawing/MonoBehaviourGizmos.cs
@@ -0,0 +1,40 @@
+using System.Collections;
+using System.Collections.Generic;
+using UnityEngine;
+
+namespace Pathfinding.Drawing {
+ /// <summary>
+ /// Inherit from this class to draw gizmos.
+ /// See: getstarted (view in online documentation for working links)
+ /// </summary>
+ public abstract class MonoBehaviourGizmos : MonoBehaviour, IDrawGizmos {
+ public MonoBehaviourGizmos() {
+#if UNITY_EDITOR
+ DrawingManager.Register(this);
+#endif
+ }
+
+ /// <summary>
+ /// An empty OnDrawGizmosSelected method.
+ /// Why an empty OnDrawGizmosSelected method?
+ /// This is because only objects with an OnDrawGizmos/OnDrawGizmosSelected method will show up in Unity's menu for enabling/disabling
+ /// the gizmos per object type (upper right corner of the scene view). So we need it here even though we don't use normal gizmos.
+ ///
+ /// By using OnDrawGizmosSelected instead of OnDrawGizmos we minimize the overhead of Unity calling this empty method.
+ /// </summary>
+ void OnDrawGizmosSelected () {
+ }
+
+ /// <summary>
+ /// Draw gizmos for this object.
+ ///
+ /// The gizmos will be visible in the scene view, and the game view, if gizmos have been enabled.
+ ///
+ /// This method will only be called in the Unity Editor.
+ ///
+ /// See: \ref{Draw}
+ /// </summary>
+ public virtual void DrawGizmos () {
+ }
+ }
+}