public static ABRuleAsset GetABRuleAsset() { var ABRulePath = AssetCustomSetting.AssetBundlerRuleAssetPath; ABRulePath = ABRulePath.Replace(UnityEngine.Application.dataPath, "Assets"); ABRuleAsset Rule = AssetDatabase.LoadAssetAtPath <ABRuleAsset>(ABRulePath); if (Rule == null) { Log.E("ABRuleAsset inexistence:{0}", ABRulePath); return(null); } return(Rule); }
public static void CreateAssetBundleRule() { Log.IColor("CreateAssetBundleRule", LogColor.OrangeRed); if (File.Exists(AssetCustomSetting.AssetBundlerRuleAssetPath)) { Log.E("AssetBundleReulAsset already existed"); } else { ABRuleAsset ruleAsset = ScriptableObject.CreateInstance <ABRuleAsset>(); var AssetPath = AssetCustomSetting.AssetBundlerRuleAssetPath.Replace(Application.dataPath, "Assets"); AssetDatabase.CreateAsset(ruleAsset, AssetPath); AssetDatabase.SaveAssets(); AssetDatabase.Refresh(); } }