Пример #1
0
 public void ReleaseAssetCallBack(AddressableItem item)
 {
     if (assetList.ContainsKey(item.GetPath()))
     {
         assetList.Remove(item.GetPath());
     }
 }
Пример #2
0
 public void GetAsset <T>(string path, Action <T> callback)
 {
     if (!assetList.ContainsKey(path))
     {
         AddressableItem item = new AddressableItem(path, ReleaseAssetCallBack);
         assetList.Add(path, item);
     }
     StartCoroutine(assetList[path].LoadAsset <T>(callback));
 }
Пример #3
0
    // Start is called before the first frame update
    void Start()
    {
        //StartCoroutine(ResMgr2.Ins.GetAsset<GameObject>("assets/cube.prefab", (obj) => { Debug.Log(obj.name); }));
        ResMgr2.Ins.GetAsset <GameObject>("Assets/Cube.prefab", (obj) => {
            Instantiate(obj).transform.localScale = Vector3.one * 5;
            AddressableItem item = ResMgr2.Ins.GetAddressableItem("Assets/Cube.prefab");
            Debug.Log(item.GetLoadCount());
            //item.ReleaseAsset();
            //Debug.Log(item.GetLoadCount());
        });

        //ResMgr2.Ins.GetAsset<GameObject>("Assets/Cube.prefab", (obj) => {
        //    Instantiate(obj).transform.localScale = Vector3.one * 5;
        //    AddressableItem item = ResMgr2.Ins.GetAddressableItem("Assets/Cube.prefab");
        //    Debug.Log(item.GetLoadCount());
        //    //item.ReleaseAsset();
        //    //Debug.Log(item.GetLoadCount());
        //});
    }