コード例 #1
0
        private static void AddAssetToAddressable()
        {
            var setting = AssetDatabase.LoadAssetAtPath <AssetConfig>("Assets/Rain/Config/Editor/AssetConfig.asset");

            var totalCount = setting.assets.Count;
            var nowIndex   = 0;

            foreach (var config in setting.assets)
            {
                if (string.IsNullOrEmpty(config.groupName))
                {
                    var path = config.folderPath.Split('/');
                    config.groupName = path[path.Length - 1];
                }

                EditorUtility.DisplayProgressBar("Addressable", $"处理 {config.groupName} 组相关内容",
                                                 1.0f * nowIndex / totalCount);
                AssetTools.CreateOrMoveAsset(config);
                ++nowIndex;
            }

            EditorUtility.DisplayProgressBar("Addressable", $"正在完成", 1);
            AssetDatabase.SaveAssets();
            AssetDatabase.Refresh();
            EditorUtility.ClearProgressBar();
            EditorUtility.DisplayDialog("Addressable", "处理完成", "Done!");
        }
コード例 #2
0
 private static void ClearMyAssetsGroup()
 {
     AssetTools.ClearGroup();
 }
コード例 #3
0
 private static void ClearMyAssets()
 {
     AssetTools.ClearAllAssets();
 }
コード例 #4
0
 private static void InitSetting()
 {
     AssetTools.LoadAddressableSettings();
 }