当前位置: 首页>>代码示例>>C#>>正文


C# AssetBundle类代码示例

本文整理汇总了C#中AssetBundle的典型用法代码示例。如果您正苦于以下问题:C# AssetBundle类的具体用法?C# AssetBundle怎么用?C# AssetBundle使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


AssetBundle类属于命名空间,在下文中一共展示了AssetBundle类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: _LoadAssets

    IEnumerator _LoadAssets(Action loadComplete, Action loadError)
    {
        if (Debug.isDebugBuild)
            _loader = new WWW(Main.HOST + _versionBundle.url);
        else
            _loader = WWW.LoadFromCacheOrDownload(Main.HOST + _versionBundle.url, _versionBundle.versionValue);
        yield return _loader;

        if (string.IsNullOrEmpty(_loader.error))
        {
            if (_versionBundle.isEncrypted)
            {
                TextAsset encryped = _loader.assetBundle.Load(BundleLoader.ENCRYPTED_DATA, typeof(TextAsset)) as TextAsset;
                byte[] encryptedData = encryped.bytes;
                byte[] decryptedData = _Decrypt(encryptedData);
                _bundle = AssetBundle.CreateFromMemory(decryptedData).assetBundle;
            }
            else
            {
                _bundle = _loader.assetBundle;
            }

            _isLoadComplete = true;

            if (loadComplete != null) loadComplete();
        }
        else
        {
            Debug.LogError("Error: Load asset error with url: " + Main.HOST + _versionBundle.url + " - " + _loader.error);
            if (loadError != null) loadError();
        }
    }
开发者ID:fuutou89,项目名称:AngeVierge,代码行数:32,代码来源:BundleLoader.cs

示例2: LoadBundle

 /// <summary>
 /// 创建
 /// </summary>
 /// <param name="decryptedData"></param>
 /// <returns></returns>
 IEnumerator LoadBundle(byte[] decryptedData)
 {
     AssetBundleCreateRequest acr = AssetBundle.CreateFromMemory(decryptedData);
     yield return acr;
     assetBundel = acr.assetBundle;
     Instantiate(assetBundel.Load("Cube"));
 }
开发者ID:ylyking,项目名称:ABXTool,代码行数:12,代码来源:NewBehaviourScript.cs

示例3: AddLoadedBundleToManager

    static void AddLoadedBundleToManager(AssetBundle bundle, string name)
    {
        if (!isBundleLoaded(bundle, name))
            return;

        AssetBundleManager.AddBundle(name, 0, bundle);
    }
开发者ID:hrajagop,项目名称:2DShooter,代码行数:7,代码来源:Loader.cs

示例4: Start

    void Start()
    {
        m_cube = AssetBundle.LoadFromFile("C:\\Users\\yunsubaek_df\\Documents\\AssetBundleTest1\\AssetBundles\\Windows\\cube-bundle");

        cube_obj = (GameObject)m_cube.LoadAsset<GameObject>("Cube");
        GameObject.Instantiate(cube_obj,new Vector3(1,1,1),Quaternion.identity);
    }
开发者ID:yunsubaek,项目名称:Unity3D,代码行数:7,代码来源:AssutBundle_example.cs

示例5: StartLoad

    private AssetBundleRequest m_cRequest; //The load request

    #endregion Fields

    #region Methods

    /// <summary>
    /// Start async load the assetbundle
    /// </summary>
    /// <param name="asset"></param>
    /// <param name="resName"></param>
    /// <param name="callback"></param>
    public static AsyncLoader StartLoad(AssetBundle asset, string resName)
    {
        GameObject obj = new GameObject("AsyncLoader");
        AsyncLoader loader = obj.AddComponent<AsyncLoader>();
        loader.StartCoroutine(loader.GoLoader(asset, resName));
        return loader;
    }
开发者ID:huangxuping,项目名称:Unity3DGameResource,代码行数:19,代码来源:AsyncLoader.cs

示例6: OnAssetBundleLoaded

    void OnAssetBundleLoaded(string url, AssetBundle assetBundle, params object[] args)
    {
        Object asset = null;
        System.DateTime beginTime = System.DateTime.Now;
        if (AssetInBundleName == null)
        {
            // 经过AddWatch调试,.mainAsset这个getter第一次执行时特别久,要做序列化
            try
            {
                asset = assetBundle.mainAsset;
            }
            catch
            {
                CBase.LogError("[OnAssetBundleLoaded:mainAsset]{0}", url);
            }
        }
        else
        {
            AssetBundleRequest request = assetBundle.LoadAsync(AssetInBundleName, typeof(Object));
            asset = request.asset;
        }

        CResourceManager.LogLoadTime("AssetFileBridge", url, beginTime);

        if (asset == null)
        {
            CBase.LogError("Asset is NULL: {0}", url);
        }

        AssetFileLoadedCallback(asset, CallbackArgs);
    }
开发者ID:mr-kelly,项目名称:ProjectWeak,代码行数:31,代码来源:CAssetFileBridge.cs

示例7: BundleLoadedHandler

    private void BundleLoadedHandler(WWW request)
    {
        Debug.Log("Bundle loaded: " + request.url);
        _bundle = request.assetBundle;

        AssetBundleRequest assetBundleRequest = _bundle.LoadAsync(AssetName, typeof(GameObject));
        _assetBundleQueue.Send(assetBundleRequest, AssetLoadedHandler);
    }
开发者ID:bwheatley,项目名称:edriven,代码行数:8,代码来源:Main2CSa.cs

示例8: DownloadAB

 IEnumerator DownloadAB()
 {
     Debug.Log("downloading...");
         yield return StartCoroutine(AssetBundleManager.downloadAssetBundle (url, version));
         bundle = AssetBundleManager.getAssetBundle (url, version);
         Debug.Log("complete");
         Debug.Log(bundle);
 }
开发者ID:Dotby,项目名称:SpaceViever,代码行数:8,代码来源:Test.cs

示例9: OnGUI

 void OnGUI()
 {
     if (GUILayout.Button ("Download bundle")){
         bundle = AssetBundleManager.getAssetBundle (url, version);
         if(!bundle)
             StartCoroutine (DownloadAB());
     }
 }
开发者ID:Dotby,项目名称:SpaceViever,代码行数:8,代码来源:Test.cs

示例10: LoadBundleFromFileUncompressed

 public IEnumerator LoadBundleFromFileUncompressed(string path)
 {
     CheckFileExists(path);
     bundle = AssetBundle.CreateFromFile(path);
     CheckBundle(bundle);
     Debug.Log("loaded bundle: " + path);
     yield return null;
 }
开发者ID:NotYours180,项目名称:AssetBundleBenchmark,代码行数:8,代码来源:AssetBundleManager.cs

示例11: GoLoader

    /// <summary>
    /// Begin load
    /// </summary>
    /// <param name="asset"></param>
    /// <param name="resName"></param>
    /// <returns></returns>
    public IEnumerator GoLoader(AssetBundle asset, string resName)
    {
        this.m_cRequest = asset.LoadAsync(resName, typeof(UnityEngine.Object));

        for (; !this.m_cRequest.isDone; )
            yield return this.m_cRequest;

        GameObject.Destroy(this.gameObject);
    }
开发者ID:huangxuping,项目名称:Unity3DGameResource,代码行数:15,代码来源:AsyncLoader.cs

示例12: Load

 public AssetBundleRequest Load(string name, Type type)
 {
     Debug.Log("Loading " + name);
     if (null == bundle)
     {
         bundle = www.assetBundle;
         www.Dispose();
     }
     return bundle.LoadAsync(name, type);
 }
开发者ID:urgamedev,项目名称:burst_bubbles,代码行数:10,代码来源:ResourceLoader.cs

示例13: initialize

    /// <summary>
    /// 初始化
    /// </summary>
    void initialize() {
        string uri = string.Empty;
        //------------------------------------Shared--------------------------------------
        uri = Util.DataPath + "shared.assetbundle";
        Debug.LogWarning("LoadFile::>> " + uri);

        shared = AssetBundle.CreateFromFile(uri);
        shared.Load("Dialog", typeof(GameObject));
        ioo.gameManager.OnResourceInited();    //回调游戏管理器,执行后续操作 
    }
开发者ID:wangwuyi,项目名称:SimpleFramework_WP,代码行数:13,代码来源:ResourceManager.cs

示例14: LoadBundleFromMemory

 public IEnumerator LoadBundleFromMemory(byte[] buffer)
 {
     AssetBundleCreateRequest bundleRequest = AssetBundle.CreateFromMemory(buffer);
     yield return bundleRequest;
     if (bundleRequest.isDone)
     {
         bundle = bundleRequest.assetBundle;
         CheckBundle(bundle);
     }
 }
开发者ID:NotYours180,项目名称:AssetBundleBenchmark,代码行数:10,代码来源:AssetBundleManager.cs

示例15: MapHandler

    public MapHandler(IMapLoader mapLoader, AssetBundle mapAsset, MapSettings mapSettings, int mapLayer)
    {
        this.mapLoader = mapLoader;
        this.bundle = mapAsset;
        this.mapSettings = mapSettings;
        this.mapLayer = mapLayer;

        this.mapOffset = new Vector3(mapSettings.length / 2, HUDConstants.MAP_HEIGHT, mapSettings.width / 2);
        this.mapBounds = new Rect();
    }
开发者ID:kartsofchaos,项目名称:game,代码行数:10,代码来源:MapHandler.cs


注:本文中的AssetBundle类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。