summaryrefslogtreecommitdiff
path: root/Other/AstarPathfindingDemo/Packages/com.arongranberg.astar/Editor/ModifierEditors/RaycastModifierEditor.cs
blob: 3a1f67837941c8f2e9cdb0c2c6c279ab8a924bec (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
using UnityEditor;

namespace Pathfinding {
	[CustomEditor(typeof(RaycastModifier))]
	[CanEditMultipleObjects]
	public class RaycastModifierEditor : EditorBase {
		protected override void Inspector () {
			PropertyField("quality");

			if (PropertyField("useRaycasting", "Use Physics Raycasting")) {
				EditorGUI.indentLevel++;

				PropertyField("use2DPhysics");
				if (PropertyField("thickRaycast")) {
					EditorGUI.indentLevel++;
					FloatField("thickRaycastRadius", min: 0f);
					EditorGUI.indentLevel--;
				}

				PropertyField("raycastOffset");
				PropertyField("mask", "Layer Mask");
				EditorGUI.indentLevel--;
			}

			PropertyField("useGraphRaycasting");
			if (!FindProperty("useGraphRaycasting").boolValue && !FindProperty("useRaycasting").boolValue) {
				EditorGUILayout.HelpBox("You should use either raycasting, graph raycasting or both, otherwise this modifier will not do anything", MessageType.Warning);
			}

			if (FindProperty("useGraphRaycasting").boolValue && !FindProperty("useRaycasting").boolValue) {
				AstarPath.FindAstarPath();
				if (AstarPath.active != null && AstarPath.active.data.gridGraph != null) {
					EditorGUILayout.HelpBox("For grid graphs, when using only graph raycasting the funnel modifier has superceded this modifier. Try using that instead. It's faster and more accurate.", MessageType.Warning);
				}
			}
		}
	}
}