浏览代码

Added NavMesh probing before displaying the pathway edition over the scene

/main
Yohann Puyhaubert 4 年前
当前提交
53f75de4
共有 1 个文件被更改,包括 14 次插入2 次删除
  1. 16
      UOP1_Project/Assets/Scripts/Editor/Pathway/PathwayEditor.cs

16
UOP1_Project/Assets/Scripts/Editor/Pathway/PathwayEditor.cs


using UnityEngine;
using UnityEngine.AI;
using UnityEditor;
using UnityEditorInternal;

private ReorderableList _reorderableList;
private PathwayConfigSO _pathway;
private PathwayHandles _pathwayHandles;
public void OnSceneGUI(SceneView sceneView)
{

_reorderableList.onChangedCallback += ListModified;
_pathway = (target as PathwayConfigSO);
_pathwayHandles = new PathwayHandles(_pathway);
SceneView.duringSceneGui += this.OnSceneGUI;
if (CheckNavMeshExistence())
{
SceneView.duringSceneGui += this.OnSceneGUI;
}
else
{
Debug.LogWarning("Pathway edition not available on this scene. NavMesh baked data missing.");
}
}
private void OnDisable()

{
_reorderableList.index = _reorderableList.serializedProperty.arraySize - 1;
}
}
private bool CheckNavMeshExistence()
{
return NavMesh.SamplePosition(Vector3.zero, out NavMeshHit hit, 1000.0f, NavMesh.AllAreas);
}
}
正在加载...
取消
保存