zoukankan      html  css  js  c++  java
  • AB打包Day01

    using System.Collections;
    using System.Collections.Generic;
    using UnityEngine;

    public class Load : MonoBehaviour {

    // Use this for initialization
    void Start () {
    string _abpath = Application.streamingAssetsPath + "\Windows\sp";///此处sp为预制体内自己所设名字

    AssetBundle ab = AssetBundle.LoadFromFile(_abpath);
    if (ab == null)
    {
    Debug.LogError("加载AB失败");
    return;
    }

    //GameObject CubeObj = ab.LoadAsset<GameObject>("Cube");
    GameObject CubeObj = ab.LoadAsset<GameObject>("Sphere,);
    if (CubeObj != null)
    {
    //加载成功
    Instantiate(CubeObj );
    }
    else
    {
    Debug.LogError("该资源不存在");
    }

    StartCoroutine("Creat", ab);
    }

    // Update is called once per frame
    void Update () {


    }

    IEnumerator Creat(AssetBundle ab)
    {
    yield return new WaitForSeconds(3);
    ab.Unload(false); //释放内存

    Debug.LogWarning("begin");
    yield return new WaitForSeconds(10);
    Instantiate(ab.LoadAsset<GameObject>("Sphere"));
    }

    }

  • 相关阅读:
    iOS7 自己定义动画跳转
    Android开发之用双缓冲技术绘图
    postgres 使用存储过程批量插入数据
    渗透过程
    python pytesseract使用
    排序算法比较
    python算法
    python中PIL模块
    数字电路复习
    windows服务参考
  • 原文地址:https://www.cnblogs.com/qipei/p/9885408.html
Copyright © 2011-2022 走看看