資源簡介
用于生成和啟用一個代理類型的NavMesh表面的NavMeshSurface。
NavMeshModifier - 基于轉換層次結構影響NavMesh區域類型的NavMesh生成。
NavMeshModifierVolume - 影響基于卷的NavMesh區域類型的NavMesh生成。
NavMeshLink - 為一個代理類型連接相同或者不同的NavMesh曲面。

代碼片段和文件信息
using?System.Collections.Generic;
using?UnityEditor;
using?UnityEngine;
using?UnityEngine.AI;
using?NavMeshBuilder?=?UnityEngine.AI.NavMeshBuilder;
[CanEditMultipleobjects]
[CustomEditor(typeof(NavMeshPrefabInstance))]
class?NavMeshPrefabInstanceEditor?:?Editor
{
????SerializedProperty?m_FollowTransformProp;
????SerializedProperty?m_NavMeshDataProp;
????public?void?OnEnable()
????{
????????m_FollowTransformProp?=?serializedobject.FindProperty(“m_FollowTransform“);
????????m_NavMeshDataProp?=?serializedobject.FindProperty(“m_NavMesh“);
????}
????public?override?void?OnInspectorGUI()
????{
????????var?instance?=?(NavMeshPrefabInstance)target;
????????var?go?=?instance.gameobject;
????????serializedobject.Update();
????????GUI.enabled?=?false;
????????EditorGUILayout.PropertyField(m_NavMeshDataProp);
????????GUI.enabled?=?true;
????????EditorGUILayout.PropertyField(m_FollowTransformProp);
????????EditorGUILayout.Space();
????????OnInspectorGUIPrefab(go);
????????serializedobject.ApplyModifiedProperties();
????}
????void?OnInspectorGUIPrefab(Gameobject?go)
????{
????????var?prefab?=?PrefabUtility.GetPrefabobject(go);
????????var?path?=?AssetDatabase.GetAssetPath(prefab);
????????if?(prefab?&&?string.IsNullOrEmpty(path))
????????{
????????????if?(GUILayout.Button(“Select?the?Prefab?asset?to?bake?or?clear?the?navmesh“?Editorstyles.helpBox))
????????????{
????????????????Selection.activeobject?=?PrefabUtility.GetPrefabParent(go);
????????????????EditorGUIUtility.Pingobject(Selection.activeobject);
????????????}
????????}
????????if?(string.IsNullOrEmpty(path))
????????????return;
????????GUILayout.BeginHorizontal();
????????GUILayout.Space(EditorGUIUtility.labelWidth);
????????if?(GUILayout.Button(“Clear“))
????????????OnClear();
????????if?(GUILayout.Button(“Bake“))
????????????OnBake();
????????GUILayout.EndHorizontal();
????}
????NavMeshData?Build(NavMeshPrefabInstance?instance)
????{
????????var?root?=?instance.transform;
????????var?sources?=?new?List();
????????var?markups?=?new?List();
????????NavMeshBuilder.CollectSources(root?~0?NavMeshCollectGeometry.RenderMeshes?0?markups?sources);
????????var?settings?=?NavMesh.GetSettingsByID(0);
????????var?bounds?=?new?Bounds(Vector3.zero?1000.0f?*?Vector3.one);
????????var?navmesh?=?NavMeshBuilder.BuildNavMeshData(settings?sources?bounds?root.position?root.rotation);
????????navmesh.name?=?“Navmesh“;
????????return?navmesh;
????}
????void?OnClear()
????{
????????foreach?(var?tgt?in?targets)
????????{
????????????var?instance?=?(NavMeshPrefabInstance)tgt;
????????????var?go?=?instance.gameobject;
????????????var?prefab?=?PrefabUtility.GetPrefabobject(go);
????????????var?path?=?AssetDatabase.GetAssetPath(prefab);
????????????if?(string.IsNullOrEmpty(path))
????????????{
????????????????Debug.LogError(“Gameobject:?“?+?go?+?“?has?no?valid?prefab?path“);
????????????????continue;
????????????}
????????????DestroyNavMeshData(path);
???????
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????目錄???????????0??2018-01-02?12:11??NavMeshComponents-2017.2.0f1\
?????文件?????????120??2018-01-02?12:11??NavMeshComponents-2017.2.0f1\.gitignore
?????目錄???????????0??2018-01-02?12:11??NavMeshComponents-2017.2.0f1\Assets\
?????文件?????????191??2018-01-02?12:11??NavMeshComponents-2017.2.0f1\Assets\Examples.me
?????目錄???????????0??2018-01-02?12:11??NavMeshComponents-2017.2.0f1\Assets\Examples\
?????文件????????3497??2018-01-02?12:11??NavMeshComponents-2017.2.0f1\Assets\Examples\Cube.prefab
?????文件?????????179??2018-01-02?12:11??NavMeshComponents-2017.2.0f1\Assets\Examples\Cube.prefab.me
?????文件?????????191??2018-01-02?12:11??NavMeshComponents-2017.2.0f1\Assets\Examples\Editor.me
?????目錄???????????0??2018-01-02?12:11??NavMeshComponents-2017.2.0f1\Assets\Examples\Editor\
?????文件????????4425??2018-01-02?12:11??NavMeshComponents-2017.2.0f1\Assets\Examples\Editor\NavMeshPrefabInstanceEditor.cs
?????文件?????????262??2018-01-02?12:11??NavMeshComponents-2017.2.0f1\Assets\Examples\Editor\NavMeshPrefabInstanceEditor.cs.me
?????文件?????????191??2018-01-02?12:11??NavMeshComponents-2017.2.0f1\Assets\Examples\Materials.me
?????目錄???????????0??2018-01-02?12:11??NavMeshComponents-2017.2.0f1\Assets\Examples\Materials\
?????文件????????2867??2018-01-02?12:11??NavMeshComponents-2017.2.0f1\Assets\Examples\Materials\brightgreen.mat
?????文件?????????179??2018-01-02?12:11??NavMeshComponents-2017.2.0f1\Assets\Examples\Materials\brightgreen.mat.me
?????文件????????2867??2018-01-02?12:11??NavMeshComponents-2017.2.0f1\Assets\Examples\Materials\brown.mat
?????文件?????????179??2018-01-02?12:11??NavMeshComponents-2017.2.0f1\Assets\Examples\Materials\brown.mat.me
?????文件????????3947??2018-01-02?12:11??NavMeshComponents-2017.2.0f1\Assets\Examples\Materials\crosshair.mat
?????文件?????????179??2018-01-02?12:11??NavMeshComponents-2017.2.0f1\Assets\Examples\Materials\crosshair.mat.me
?????文件????????2865??2018-01-02?12:11??NavMeshComponents-2017.2.0f1\Assets\Examples\Materials\floor.mat
?????文件?????????179??2018-01-02?12:11??NavMeshComponents-2017.2.0f1\Assets\Examples\Materials\floor.mat.me
?????文件????????2867??2018-01-02?12:11??NavMeshComponents-2017.2.0f1\Assets\Examples\Materials\green.mat
?????文件?????????179??2018-01-02?12:11??NavMeshComponents-2017.2.0f1\Assets\Examples\Materials\green.mat.me
?????文件????????2863??2018-01-02?12:11??NavMeshComponents-2017.2.0f1\Assets\Examples\Materials\grey.mat
?????文件?????????179??2018-01-02?12:11??NavMeshComponents-2017.2.0f1\Assets\Examples\Materials\grey.mat.me
?????文件????????1036??2018-01-02?12:11??NavMeshComponents-2017.2.0f1\Assets\Examples\Materials\modify_crosshair.png
?????文件????????1184??2018-01-02?12:11??NavMeshComponents-2017.2.0f1\Assets\Examples\Materials\modify_crosshair.png.me
?????文件????????2863??2018-01-02?12:11??NavMeshComponents-2017.2.0f1\Assets\Examples\Materials\red.mat
?????文件?????????179??2018-01-02?12:11??NavMeshComponents-2017.2.0f1\Assets\Examples\Materials\red.mat.me
?????文件????????2849??2018-01-02?12:11??NavMeshComponents-2017.2.0f1\Assets\Examples\Materials\yellow.mat
?????文件?????????179??2018-01-02?12:11??NavMeshComponents-2017.2.0f1\Assets\Examples\Materials\yellow.mat.me
............此處省略193個文件信息
- 上一篇:大數據真實數倉項目完整版
- 下一篇:Pygame游戲源代碼:超級瑪麗.rar
評論
共有 條評論