12345678910111213141516171819202122232425262728293031323334353637383940414243444546 |
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- using VEngine;
- namespace GFGGame
- {
- public class GFGAsset
- {
- public static T Load<T>(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<T>(path);
- }
- return t;
- }
- public static void Release(string path)
- {
- //VEngine.Logger.I($"GFGAsset.Release {path} {Random.Range(0, int.MaxValue)}");
- if (path.Contains("Asset"))
- {
- Asset asset;
- if (Asset.Cache.TryGetValue(path, out asset))
- {
- asset.Release();
- }
- }
- else
- {
- }
- }
- }
- }
|