您现在的位置是:Instagram刷粉絲, Ins買粉絲自助下單平台, Ins買贊網站可微信支付寶付款 >
01 youtube playlist editor utility(如何在 Unity 中獲取某個對象的依賴關系)
Instagram刷粉絲, Ins買粉絲自助下單平台, Ins買贊網站可微信支付寶付款2024-06-04 05:33:46【】0人已围观
简介EditorUtility.DisplayDialogunity3d中這個要怎么用這個是一個Editor類,在需要拓展編輯的時候使用,發布游戲的時候其不會被編譯。通俗點:其不能在派生自MonoBeha
EditorUtility.DisplayDialog unity3d中這個要怎么用
這個是一個Editor類,在需要拓展編輯的時候使用,發布游戲的時候其不會被編譯。通俗點:其不能在派生自MonoBehaviour類中使用,它是用來寫插件的,游戲程序中不能使用
要使用此類,如下幾點缺一不可
1 添加命名空間 using UnityEditor ;
2 此類要放在名為Editor的文件中 (Editor文件夾個數不限)
(具體可以搜索幫助文檔)
如何在 Unity 中獲取某個對象的依賴關系
在 Unity 中目前我發現了獲取依賴關系的兩個 API 接口,分別是:
EditorUtility.CollectDependencies
AssetDatabase.GetDependencies
其中 AssetDatabase.GetDependencies 獲取到的結果就是上面演示的那樣,是大粒度的依賴關系。而 EditorUtility.CollectDependencies 獲取到的是小粒度的依賴關系,所依賴的組件和 Shader 等都會列出來,非常的仔細。
C#
#if UNITY_EDITOR
using UnityEngine;
using System.Collections;
using UnityEditor;
namespace PT.Find
{
[ExecuteInEditMode]
public static class Find
{
[MenuItem("Find/What objects in scene use this?", false, 20)]
public static void SelectSceneUsesOfAsset()
{
Object selectedObject = Selection.activeObject;
if (selectedObject == null)
{
return;
}
Object[] roots = new Object[]{ selectedObject };
var objs = EditorUtility.CollectDependencies(roots);
string path = AssetDatabase.GetAssetPath(selectedObject);
var objs2 = AssetDatabase.GetDependencies(path);
foreach (var obj in objs)
{
Debug.Log(obj.GetType().Name);
}
}
}
}
#endif
#if UNITY_EDITOR
using UnityEngine;
using System.Collections;
using UnityEditor;
namespace PT.Find
{
[ExecuteInEditMode]
public static class Find
{
[MenuItem("Find/What objects in scene use this?", false, 20)]
public static void SelectSceneUsesOfAsset()
{
Object selectedObject = Selection.activeObject;
if (selectedObject == null)
{
return;
}
Object[] roots = new Object[]{ selectedObject };
var objs = EditorUtility.CollectDependencies(roots);
string path = AssetDatabase.GetAssetPath(selectedObject);
var objs2 = AssetDatabase.GetDependencies(path);
foreach (var objin objs)
{
Debug.Log(obj.GetType().Name);
}
}
}
}
#endif
不得不說,Unity Editor 提供的默認的依賴查找的功能好弱,包括反向依賴關系,引用關系丟失等功能。或許我們可以利用這些接口自己做一個好用點的依賴關系查找插件。
EditorUtility.DisplayDialog unity3d中這個要怎么用
這個是一個Editor類,在需要拓展編輯的時候使用,發布游戲的時候其不會被編譯。通俗點:其不能在派生自MonoBehaviour類中使用,它是用來寫插件的,游戲程序中不能使用
要使用此類,如下幾點缺一不可
1 添加命名空間 using UnityEditor ;
2 此類要放在名為Editor的文件中 (Editor文件夾個數不限)
(具體可以搜索幫助文檔)
如何在 Unity 中獲取某個對象的依賴關系
在 Unity 中目前我發現了獲取依賴關系的兩個 API 接口,分別是:
EditorUtility.CollectDependencies
AssetDatabase.GetDependencies
其中 AssetDatabase.GetDependencies 獲取到的結果就是上面演示的那樣,是大粒度的依賴關系。而 EditorUtility.CollectDependencies 獲取到的是小粒度的依賴關系,所依賴的組件和 Shader 等都會列出來,非常的仔細。
C#
#if UNITY_EDITOR
using UnityEngine;
using System.Collections;
using UnityEditor;
namespace PT.Find
{
[ExecuteInEditMode]
public static class Find
{
[MenuItem("Find/What objects in scene use this?", false, 20)]
public static void SelectSceneUsesOfAsset()
{
Object selectedObject = Selection.activeObject;
if (selectedObject == null)
{
return;
}
Object[] roots = new Object[]{ selectedObject };
var objs = EditorUtility.CollectDependencies(roots);
string path = AssetDatabase.GetAssetPath(selectedObject);
var objs2 = AssetDatabase.GetDependencies(path);
foreach (var obj in objs)
{
Debug.Log(obj.GetType().Name);
}
}
}
}
#endif
#if UNITY_EDITOR
using UnityEngine;
using System.Collections;
using UnityEditor;
namespace PT.Find
{
[ExecuteInEditMode]
public static class Find
{
[MenuItem("Find/What objects in scene use this?", false, 20)]
public static void SelectSceneUsesOfAsset()
{
Object selectedObject = Selection.activeObject;
if (selectedObject == null)
{
return;
}
Object[] roots = new Object[]{ selectedObject };
var objs = EditorUtility.CollectDependencies(roots);
string path = AssetDatabase.GetAssetPath(selectedObject);
var objs2 = AssetDatabase.GetDependencies(path);
foreach (var objin objs)
{
Debug.Log(obj.GetType().Name);
}
}
}
}
#endif
不得不說,Unity Editor 提供的默認的依賴查找的功能好弱,包括反向依賴關系,引用關系丟失等功能。或許我們可以利用這些接口自己做一個好用點的依賴關系查找插件。
很赞哦!(3)
相关文章
- 01 華為手機app訂閱取消(怎樣取消訂閱號消息)
- 01 華為售后買粉絲是多少(華為買粉絲買粉絲號在哪?)
- 01 華為手機怎么看訂閱軟件(華為手機如何查看訂閱收費)
- 03 youtube官網 中文新聞數據新聞案例2022(新媒體運營平臺有哪些?)
- 01 華為手機在海外怎么用uber(為什么華為下載了uber不能打開呢?)
- 03 youtube下載網站高清背景圖素材網站(有沒有哪些很全面的美術生需要用到的找靈感的設計網站?)
- 03 youtube下載網站高清圖片壁紙桌面(ps作品集模板圖片-大學生如何通過ps賺錢)
- 01 華為在哪里取消訂閱自動續費(華為自動續費怎么關閉)
- 03 youtube官網 中文新聞主題分類法是按照(誰知道這圖片里的妹子是什么組合)
- 03 youtube中文版下載官網正版軟件檢查工具(PS軟件各個版本區別大嗎?哪個版本最適合新手?)