Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Unity 5 for Android Essentials

You're reading from   Unity 5 for Android Essentials A fast-paced guide to building impressive games and applications for Android devices with Unity 5

Arrow left icon
Product type Paperback
Published in Aug 2015
Publisher
ISBN-13 9781784399191
Length 200 pages
Edition 1st Edition
Tools
Arrow right icon
Author (1):
Arrow left icon
Valera Cogut Valera Cogut
Author Profile Icon Valera Cogut
Valera Cogut
Arrow right icon
View More author details
Toc

Downloading new code and data in real time for Android devices


In the event of retrieving assets from your bundles, you can use three separate functions:

  • AssetBundle.Load: This will load one object only by the given name; also it will block the main thread.

  • AssetBundle.LoadAsync: This will load one object only by a given name; it will not block the main thread. Use this method for huge assets.

  • AssetBundle.LoadAll: This will load every object from your AssetBundle.

Use the AssetBundle.Unload method in the event of unloading assets. Let's look at a simple usage example of the asynchronous method as shown in the following code without any exception handling and any checks (just as skeleton):

using UnityEngine;
using System.Collections;

public class GetAssetBundleAsync : MonoBehaviour {
  public string assetBundleUrl = "http://yourweb.com/yourBundle.unity3d";
  public int assetBundleVersion = 1;

  IEnumerator Start() {
    WWW www = WWW.LoadFromCacheOrDownload(
      assetBundleUrl, assetBundleVersion...
lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime
Banner background image