您现在的位置是:Instagram刷粉絲, Ins買粉絲自助下單平台, Ins買贊網站可微信支付寶付款 >
01 youtube playlist editor utility(如何在 Unity 中獲取某個對象的依賴關系)
Instagram刷粉絲, Ins買粉絲自助下單平台, Ins買贊網站可微信支付寶付款2024-07-07 11:52:06【】9人已围观
简介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)
相关文章
- 01 訂閱號助手下載教程視頻全集自學(訂閱號助手怎么解除綁定)
- 07 youtube to mp3 tom 買粉絲(有一首歌歌詞是“IT IS OK~~”是什么歌名啊?)
- 07 youtuber是什么意思英語聊天(我的世界108個小技巧,我的世界小技巧大全)
- 07 youtube.買粉絲 hk music(今日新聞淺談:Youtube Music 也加入串流音樂服務大混戰)
- 07 youtube to mp3 買粉絲 software是什么公司簡稱(P2P是什么意?)
- 01 訂閱號助手下載方法2023已更新今日(如何下載買粉絲中的訂閱號助手)
- 07 youtube下載工具 命令行參數輸入教程(哪里有CS的精彩視頻可以下載啊?)
- 01 訂閱號助手下載方法ppt圖片排版(如何粘貼到訂閱號助手)
- 07 youtube下載安裝教程詳細版怎么(電腦pr怎么下載)
- 01 訂閱號助手下載方法ppt模板怎么(訂閱號助手怎么添加封面)
热门文章
站长推荐
07 youtube下載工具 命令行工具是干什么(怎樣才能學好python語言?)
07 youtube下載安裝地址更改器免費(華為海外再突破AppGallery上架WeGo Maps,沒GMS華為發力了,如何評價?)
01 訂閱號助手下載地址請重試如果錯誤(訂閱號助手顯示實名消息錯誤)
01 訂閱號助手下載地址解析網站在線(訂閱號助手怎么解除綁定)
01 訂閱號助手下載方法ppt免費在線轉換(訂閱號助手怎么解除綁定 如何解綁訂閱號助手?)
07 youtube下載電腦版工具在哪里打開藍牙(你們用過的最好用的電視盒子是哪個品牌的?)
07 youtube to pdf 買粉絲(芭比動畫片的片尾曲叫什么名字?)
01 訂閱號助手下載方法教程百度網(手機訂閱號助手不發送如何生成永久鏈接)