コード例 #1
0
        public void OnPreprocessSpriteAtlas(string importAssetPath, AssetImporter assetImporter)
        {
            string templateAssetPath = GetTemplateAssetPath(importAssetPath);

            if (string.IsNullOrEmpty(templateAssetPath))
            {
                throw new System.Exception($"图集资源模板获取失败:{importAssetPath}");
            }

            SpriteAtlas template = AssetDatabase.LoadAssetAtPath <SpriteAtlas>(templateAssetPath);
            SpriteAtlas target   = AssetDatabase.LoadAssetAtPath <SpriteAtlas>(importAssetPath);

            ImporterCopyer.CopySpriteAtlasSetting(target, template);
            Debug.Log($"[DefaultProcessor] 资源格式设置完毕 : {importAssetPath}");
        }
コード例 #2
0
        public void OnPreprocessAudio(string importAssetPath, AssetImporter assetImporter)
        {
            AudioImporter templateImporter = GetTemplateAssetImporter(importAssetPath) as AudioImporter;

            if (templateImporter == null)
            {
                return;
            }

            // 如果模板被更改,那么更新全部资源
            if (Path.GetFileName(importAssetPath) == Path.GetFileName(templateImporter.assetPath))
            {
                ProcessAllAudio(templateImporter);
                return;
            }

            AudioImporter targetImporter = assetImporter as AudioImporter;

            ImporterCopyer.CopyAudioImporter(targetImporter, templateImporter);
            Debug.Log($"[DefaultProcessor] 资源格式设置完毕 : {importAssetPath}");
        }