/// <summary> /// 初始化manifestAsset。方便直接读取 /// </summary> private static void InitManifest(MyBundle bundle = null) { #if UNITY_EDITOR //直接读取项目资源 if (FrameworkDefaultSetting.useEditorPrefab) { string path = BuildDefaultPath.GetManifestAssetPath(); var manifestAsset = UnityEditor.AssetDatabase.LoadAssetAtPath <PackageManifest>(path); manifestAsset.MapingAssetData(); manifest.Load(manifestAsset); } else //从Bundle中读取 { if (bundle == null) { Console.WriteLine("从Bundle中读取Manifest失败!!!!"); return; } var manifestAsset = bundle.LoadAsset <PackageManifest>(RuntimeResPath.GetManifestAssetPath); manifestAsset.MapingAssetData(); manifest.Load(manifestAsset); } #else if (bundle == null) { Console.WriteLine("从Bundle中读取Manifest失败!!!!"); return; } var manifestAsset = bundle.LoadAsset <PackageManifest>(RuntimeResPath.GetManifestAssetPath); manifestAsset.MapingAssetData(); manifest.Load(manifestAsset); #endif }
protected override void OnLoad() { bundle = MyBundles.Load(MyAssets.GetBundleByAssetName(assetName)); asset = bundle.LoadAsset(MyAssets.GetAssetPathByAssetName(assetName), assetType); }