Resources.UnloadAsset(a);的用法

来源:互联网 发布:淘宝 时生 东野圭吾 编辑:程序博客网 时间:2024/06/06 14:11


using UnityEngine;

using System.Collections;


public class UnLoadTest : MonoBehaviour
{
    private  Object a;
    void Start()
    {
        a = Instantiate(Resources.Load("Cube"));
    }


    
    void Update()
    {
        if (Input.GetKey(KeyCode.A))
        {
            Destroy(a);
            StartCoroutine(ree());
        }
    }
    IEnumerator ree()
    {
        Debug.Log(a);
        yield return new WaitForSeconds(1);
        Resources.UnloadAsset(a);
    }


}
0 0
原创粉丝点击