Assignment for RMIT Mixed Reality in 2020
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

45 lines
1.4 KiB

namespace VRTK
{
using UnityEditor;
[CustomEditor(typeof(VRTK_NavMeshData), true)]
public class VRTK_NavMeshDataEditor : Editor
{
public new VRTK_NavMeshData target { get { return base.target as VRTK_NavMeshData; } }
private SerializedProperty distanceLimit = null;
private bool _showLayers;
public override void OnInspectorGUI()
{
EditorGUILayout.PropertyField(distanceLimit);
_showLayers = EditorGUILayout.Foldout(_showLayers, VRTK_EditorUtilities.BuildGUIContent<VRTK_NavMeshData>("validAreas"));
if (_showLayers)
{
EditorGUI.indentLevel++;
int currentAreas = target.validAreas;
string[] areas = GameObjectUtility.GetNavMeshAreaNames();
for (int i = 0; i < areas.Length; i++)
{
var selected = (currentAreas & (1 << i)) != 0;
if (EditorGUILayout.Toggle(areas[i], selected))
{
target.validAreas |= (1 << i);
}
else
{
target.validAreas &= ~(1 << i);
}
}
EditorGUI.indentLevel--;
}
}
protected virtual void OnEnable()
{
distanceLimit = serializedObject.FindProperty("distanceLimit");
}
}
}