using System.Collections; using System.Collections.Generic; using UnityEngine; using VEngine; namespace GFGGame { public class GFGAsset { public static T Load(string path) where T : Object { //VEngine.Logger.I($"GFGAsset.Load {path} {Random.Range(0, int.MaxValue)}"); T t = null; if (path.Contains("Asset")) { Asset asset = VEngine.Asset.Load(path, typeof(T)); if (asset != null) { t = asset.asset as T; } } else { t = Resources.Load(path); } return t; } public static void Release(string path) { //VEngine.Logger.I($"GFGAsset.Release {path} {Random.Range(0, int.MaxValue)}"); if (path.Contains("Asset")) { int count = 0; if (Asset.CacheCount.TryGetValue(path, out count)) { count--; } if (count > 0) return; Asset asset; if (Asset.Cache.TryGetValue(path, out asset)) { asset.Release(); } } else { } } } }