资源简介
用于生成和启用一个代理类型的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
相关资源
- [深蓝]外卖订餐 在线下单短信通知4
- 3DSMAX导出GLTF插件内涵多个版本,安装
- 大漠插件3.1232 最后免费的全功能插件
- idea2018.1 lombok 0.17插件已编译直接引入
- AnkhSvn-2.1.7444.278.msi & AnkhSvn-2.1.8420.8.
- Photoshop修改DTX 所需全部文件
- aurora 插件 word中写latex公式
- 遥感二维光谱特征空间ENVI插件
- MEF 结合 MVVMLight
- Super ScrollView for UGUI.unitypackage
- restclient 火狐插件
- Rain插件下雨粒子
- VA_X1738破解版(Visual Studio著名插件,
- idea zookeeper插件
- OA协同pdf在线打开插件
- share ex2 带插件
- CAD去教育版插件
- CAD制图在线查看插件
- 西红柿插件完美支持vs2008
- gh插件关于weaverbird
- book-page.unitypackage
- lsp插件合集
- Axwoman6.3_ArcGIS10.4版本
- Axwoman6.3_ArcGIS10.3版本
- discuz论坛插件DZ插件 万能表单报名系
- wordpress采集插件wp-autopost-pro专业版
- 广联达土建、钢筋算量双开插件
- 换ip工具——极光换ip插件
- 线报转发插件
- ENVI去云插件和教程
评论
共有 条评论