static private AssetGenerateInfo GetAssetGenerateInfo(AssetGenerator.GeneratorEntry entry, Model.NodeData node, BuildTarget target, AssetReference asset) { var cacheDir = FileUtility.EnsureAssetGeneratorCacheDirExists(target, node); var generateInfoDir = FileUtility.PathCombine(cacheDir, entry.m_id); var generatorInfoPath = FileUtility.PathCombine(generateInfoDir, asset.fileNameAndExtension + ".asset"); return(AssetDatabase.LoadAssetAtPath <AssetGenerateInfo>(generatorInfoPath)); }
static public bool DoesAssetNeedRegenerate(AssetGenerator.GeneratorEntry entry, Model.NodeData node, BuildTarget target, AssetReference asset) { var generateInfo = GetAssetGenerateInfo(entry, node, target, asset); // need rebuilding if no buildInfo found if (generateInfo == null) { return(true); } // need rebuilding if given builder is changed if (generateInfo.m_generatorClass != entry.m_instance.ClassName) { return(true); } // need rebuilding if given builder is changed if (generateInfo.m_instanceData != entry.m_instance[target]) { return(true); } var version = AssetGeneratorUtility.GetVersion(entry.m_instance.ClassName); // need rebuilding if given builder version is changed if (generateInfo.m_generatorVersion != version) { return(true); } if (generateInfo.m_usedAsset.importFrom != asset.importFrom) { return(true); } // If asset is modified from last time, then need rebuilding if (generateInfo.m_usedAsset.IsAssetModifiedFromLastTime) { return(true); } return(false); }
static public void SaveAssetGenerateInfo(AssetGenerator.GeneratorEntry entry, Model.NodeData node, BuildTarget target, AssetReference asset) { var cacheDir = FileUtility.EnsureAssetGeneratorCacheDirExists(target, node); var generateInfoDir = FileUtility.PathCombine(cacheDir, entry.m_id); if (!Directory.Exists(generateInfoDir)) { Directory.CreateDirectory(generateInfoDir); } var generatorInfoPath = FileUtility.PathCombine(generateInfoDir, asset.fileNameAndExtension + ".asset"); var version = AssetGeneratorUtility.GetVersion(entry.m_instance.ClassName); var info = ScriptableObject.CreateInstance <AssetGenerateInfo>(); info.Initialize(entry.m_instance.ClassName, entry.m_instance[target], version, asset); AssetDatabase.CreateAsset(info, generatorInfoPath); }