您现在的位置是:Instagram刷粉絲, Ins買粉絲自助下單平台, Ins買贊網站可微信支付寶付款 >
01 youtube playlist editor utility(EditorUtility.DisplayDialog unity3d中這個要怎么用)
Instagram刷粉絲, Ins買粉絲自助下單平台, Ins買贊網站可微信支付寶付款2024-06-11 10:08:46【】6人已围观
简介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 提供的默認的依賴查找的功能好弱,包括反向依賴關系,引用關系丟失等功能。或許我們可以利用這些接口自己做一個好用點的依賴關系查找插件。
很赞哦!(4)
相关文章
- 02 廣州網紅打卡圣地小紅書(南沙旅游攻略)
- 01 買粉絲怎么設置菜單欄考試功能(買粉絲買粉絲如何設置菜單?)
- 02 廣州貿易職業高級中學中山六路校區(廣州市貿易職業高級中學是職高嗎)
- 01 買粉絲怎么清除格式(買粉絲買粉絲如何改字體)
- 01 買粉絲怎么添加地址導航位置(怎么為買粉絲公眾平臺添加地圖?)
- 01 買粉絲怎么轉人工客服(買粉絲客服怎么轉人工)
- 01 買粉絲怎么給圖片加注釋(如何將買粉絲買粉絲里面的圖片添加文字信息?)
- 02 廣州網紅打卡景點沙面(廣州沙面游玩攻略)
- 02 廣州聚灣貿易有限公司(2021第三屆國際汽車智能共享出行大會開幕 共謀綠色智慧出行)
- 01 買粉絲怎么看取消關注的粉絲(買粉絲買粉絲能查看到取消關注的粉絲的詳細資料嗎)