当前位置:网站首页>Unity addressable batch management
Unity addressable batch management
2022-06-25 08:26:00 【Teddy with one abdominal muscle】
Unity Use Addressable Achieve batch management
Recent project resource management uses Unity Resource addressing system AddressablesAsset, However, the amount of general resources in the project is small , So we are all dragging resources one by one Group in , And then modify address(Addressable Name)
Or in Prefab Of Inspector Modify on the panel 
But when there are too many resources , This method is too inefficient . Originally, I wanted to directly drag the entire folder to Group in , It turns out that the sub files in the folder , None of them Addressable Mark , And the resource cannot be found after packaging . in other words , Send the whole folder in , No hair , Or do you want to manage resources separately .
What to do in this situation , Find your own interface and write your own editor .
And then in UnityEditor Next , Find several interfaces .
[MenuItem("Tools/ add to Addressables")]
private static void AddAddressables()
{
string assetPath = "Assets/AssetBundleResources/Main/Cube.prefab";
string guid = AssetDatabase.AssetPathToGUID(assetPath);
AddressableAssetGroup group = AddressableAssetSettingsDefaultObject.Settings.FindGroup("Public");
AddressableAssetSettingsDefaultObject.Settings.CreateOrMoveEntry(guid, group);
AddressableAssetEntry addressableAssetEntry = AddressableAssetSettingsDefaultObject.Settings.FindAssetEntry(guid);
addressableAssetEntry.SetAddress("Cube.prefab");
Debug.Log(addressableAssetEntry.address);
//AddressableAssetSettingsDefaultObject.Settings.RemoveAssetEntry(guid);
}
This is the code I tested , This resource is added and deleted respectively , I used the original path Application.datapath+“/AssetBundleResources/Main/Cube.prefab", But I can't , Acquired GUID It's empty , I'll change it to "Assets/AssetBundleResources/Main/Cube.prefab", The normal , Subsequent extensions are not done , After a delay, you can traverse the sub files under the entire folder , Then add and delete the resources in the entire folder .
边栏推荐
- How to analyze the coupling coordination index?
- Go language learning tutorial (13)
- First experience Amazon Neptune, a fully managed map database
- 420 sequence traversal of binary tree 2 (429. sequence traversal of n-ary tree, 515. find the maximum value in each tree row, 116. fill in the next right node pointer of each node, 104. maximum depth
- Jdbc-dao layer implementation
- Niuke: flight route (layered map + shortest path)
- Logu P2486 [sdoi2011] coloring (tree chain + segment tree + merging of intervals on the tree)
- 第五天 脚本与UI系统
- Matlab code format one click beautification artifact
- Set the textalign property of the label control in C to control the method of text centering
猜你喜欢

How to calculate the information entropy and utility value of entropy method?

Log in to MySQL 5.7 under ubuntu18 and set the root password

Self made ramp, but it really smells good

STM32CubeMX 學習(5)輸入捕獲實驗

以科技赋能设计之美,vivo携手知名美院打造“产学研”计划

家庭服务器门户Easy-Gate

双周投融报:资本埋伏Web3基础设施

使用apt-get命令如何安装软件?

Almost taken away by this wave of handler interview cannons~

测一测现在的温度
随机推荐
How to calculate the independence weight index?
使用apt-get命令如何安装软件?
[supplementary question] 2021 Niuke summer multi school training camp 6-n
[QT] qtcreator shortcut key and QML introduction
Is there any risk in the security of new bonds
How to calculate the fuzzy comprehensive evaluation index? How to calculate the four fuzzy operators?
Data-centric vs. Model-centric. The Answer is Clear!
How to calculate critical weight indicators?
The era of enterprise full cloud -- the future of cloud database
Luogu p2839 [national training team]middle (two points + chairman tree + interval merging)
The difference between personal domain name and enterprise domain name
Rqt command
Self made ramp, but it really smells good
FFT [template]
在二叉树(搜索树)中找到两个节点的最近公共祖先(剑指offer)
Is it safe to open an account online? Xiaobai asks for guidance
图像超分综述:超长文一网打尽图像超分的前世今生 (附核心代码)
2022年毕业生求职找工作青睐哪个行业?
leetcode.13 --- 罗马数字转整数
How is the ISM model analyzed?