Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
爱小饭呀
navmeshcomponents
提交
9af3291f
N
navmeshcomponents
项目概览
爱小饭呀
/
navmeshcomponents
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
N
navmeshcomponents
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
9af3291f
编写于
4月 13, 2018
作者:
A
Adrian T
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fix compilation errors and warnings caused by prefabs-related changes in the API.
上级
b8468647
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
13 addition
and
10 deletion
+13
-10
Assets/Examples/Editor/NavMeshPrefabInstanceEditor.cs
Assets/Examples/Editor/NavMeshPrefabInstanceEditor.cs
+2
-2
Assets/NavMeshComponents/Editor/NavMeshSurfaceEditor.cs
Assets/NavMeshComponents/Editor/NavMeshSurfaceEditor.cs
+2
-3
Assets/NavMeshComponents/Scripts/NavMeshSurface.cs
Assets/NavMeshComponents/Scripts/NavMeshSurface.cs
+9
-5
未找到文件。
Assets/Examples/Editor/NavMeshPrefabInstanceEditor.cs
浏览文件 @
9af3291f
...
...
@@ -45,7 +45,7 @@ void OnInspectorGUIPrefab(GameObject go)
{
if
(
GUILayout
.
Button
(
"Select the Prefab asset to bake or clear the navmesh"
,
EditorStyles
.
helpBox
))
{
Selection
.
activeObject
=
PrefabUtility
.
Get
PrefabParent
(
go
);
Selection
.
activeObject
=
PrefabUtility
.
Get
CorrespondingObjectFromSource
(
go
);
EditorGUIUtility
.
PingObject
(
Selection
.
activeObject
);
}
}
...
...
@@ -71,7 +71,7 @@ NavMeshData Build(NavMeshPrefabInstance instance)
var
sources
=
new
List
<
NavMeshBuildSource
>();
var
markups
=
new
List
<
NavMeshBuildMarkup
>();
NavMeshBuilder
.
CollectSources
(
root
,
~
0
,
NavMeshCollectGeometry
.
RenderMeshes
,
0
,
markups
,
sources
);
NavMeshBuilder
.
CollectSources
(
root
,
~
0
,
NavMeshCollectGeometry
.
RenderMeshes
,
0
,
markups
,
instance
.
gameObject
.
scene
,
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
);
...
...
Assets/NavMeshComponents/Editor/NavMeshSurfaceEditor.cs
浏览文件 @
9af3291f
...
...
@@ -110,11 +110,10 @@ static void CreateNavMeshAsset(NavMeshSurface surface)
static
NavMeshData
GetNavMeshAssetToDelete
(
NavMeshSurface
navSurface
)
{
var
prefabType
=
PrefabUtility
.
GetPrefabType
(
navSurface
);
if
(
prefabType
==
PrefabType
.
PrefabInstance
||
prefabType
==
PrefabType
.
DisconnectedPrefabInstance
)
if
(
PrefabUtility
.
IsPartOfPrefabInstance
(
navSurface
)
&&
!
PrefabUtility
.
IsPartOfModelPrefab
(
navSurface
))
{
// Don't allow deleting the asset belonging to the prefab parent
var
parentSurface
=
PrefabUtility
.
Get
PrefabParent
(
navSurface
)
as
NavMeshSurface
;
var
parentSurface
=
PrefabUtility
.
Get
CorrespondingObjectFromSource
(
navSurface
)
as
NavMeshSurface
;
if
(
parentSurface
&&
navSurface
.
navMeshData
==
parentSurface
.
navMeshData
)
return
null
;
}
...
...
Assets/NavMeshComponents/Scripts/NavMeshSurface.cs
浏览文件 @
9af3291f
using
System.Collections.Generic
;
using
UnityEditor
;
using
UnityEditor.SceneManagement
;
namespace
UnityEngine.AI
{
...
...
@@ -252,6 +254,7 @@ List<NavMeshBuildSource> CollectSources()
modifiers
=
NavMeshModifier
.
activeModifiers
;
}
var
scene
=
gameObject
.
scene
;
foreach
(
var
m
in
modifiers
)
{
if
((
m_LayerMask
&
(
1
<<
m
.
gameObject
.
layer
))
==
0
)
...
...
@@ -268,17 +271,17 @@ List<NavMeshBuildSource> CollectSources()
if
(
m_CollectObjects
==
CollectObjects
.
All
)
{
NavMeshBuilder
.
CollectSources
(
null
,
m_LayerMask
,
m_UseGeometry
,
m_DefaultArea
,
markups
,
sources
);
NavMeshBuilder
.
CollectSources
(
null
,
m_LayerMask
,
m_UseGeometry
,
m_DefaultArea
,
markups
,
s
cene
,
s
ources
);
}
else
if
(
m_CollectObjects
==
CollectObjects
.
Children
)
{
NavMeshBuilder
.
CollectSources
(
transform
,
m_LayerMask
,
m_UseGeometry
,
m_DefaultArea
,
markups
,
sources
);
NavMeshBuilder
.
CollectSources
(
transform
,
m_LayerMask
,
m_UseGeometry
,
m_DefaultArea
,
markups
,
s
cene
,
s
ources
);
}
else
if
(
m_CollectObjects
==
CollectObjects
.
Volume
)
{
Matrix4x4
localToWorld
=
Matrix4x4
.
TRS
(
transform
.
position
,
transform
.
rotation
,
Vector3
.
one
);
var
worldBounds
=
GetWorldBounds
(
localToWorld
,
new
Bounds
(
m_Center
,
m_Size
));
NavMeshBuilder
.
CollectSources
(
worldBounds
,
m_LayerMask
,
m_UseGeometry
,
m_DefaultArea
,
markups
,
sources
);
NavMeshBuilder
.
CollectSources
(
worldBounds
,
m_LayerMask
,
m_UseGeometry
,
m_DefaultArea
,
markups
,
s
cene
,
s
ources
);
}
if
(
m_IgnoreNavMeshAgent
)
...
...
@@ -368,8 +371,9 @@ bool UnshareNavMeshAsset()
return
false
;
// Prefab parent owns the asset reference
var
prefabType
=
UnityEditor
.
PrefabUtility
.
GetPrefabType
(
this
);
if
(
prefabType
==
UnityEditor
.
PrefabType
.
Prefab
)
var
isInPreviewScene
=
EditorSceneManager
.
IsPreviewSceneObject
(
this
);
var
isPersistentObject
=
EditorUtility
.
IsPersistent
(
this
);
if
(
isInPreviewScene
||
isPersistentObject
)
return
false
;
// An instance can share asset reference only with its prefab parent
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录