SlideShare a Scribd company logo
1 of 69
Download to read offline






問題を解決するときはいつも、もっとも抵抗の少
ない道を選んで行けばたやすく解決しそうに見え
る。 しかして、その易しそうな道こそが最も過酷
で残酷なものに変質するのだ…
-Winston Churchill
•
•
•
•
•
•
•
•
•
•
Unityプロジェクト 開発初週 - 直接参照
public class spawnCarFromDirectReference : MonoBehaviour
{
public GameObject carPrefab;
void Start ()
{
if(carPrefab != null)
GameObject.Instantiate(carPrefab, this.transform, false);
}
}
Unityプロジェクト,開発2週目 - Resources.Load
public class spawnCarFromResources : MonoBehaviour
{
public string carName;
void Start ()
{
var go = Resources.Load<GameObject>(carName);
if(go != null)
GameObject.Instantiate(go, this.transform, false);
}
}
Unityプロジェクト,開発3週目 - Resources.LoadAsync
public class spawnCarFromResourcesAsync : MonoBehaviour
{
public string carName;
IEnumerator Start ()
{
var req = Resources.LoadAsync(carName);
yield return req;
if(req.asset != null)
GameObject.Instantiate(req.asset, this.transform, false);
}
}
そして3ヶ月の時が流れた ...
Resourcesからアセットバンドルへの変更
public class MyBuildProcess
{
...
[MenuItem("Build/Build Asset Bundles")]
public static void BuildAssetBundles()
{
var outputPath = bundleBuildPath;
if(!Directory.Exists(outputPath))
Directory.CreateDirectory(outputPath);
var manifest = BuildPipeline.BuildAssetBundles(outputPath,
BuildAssetBundleOptions.ChunkBasedCompression,
EditorUserBuildSettings.activeBuildTarget);
var bundlesToCopy = new List<string>(manifest.GetAllAssetBundles());
// Copy the manifest file
bundlesToCopy.Add(EditorUserBuildSettings.activeBuildTarget.ToString());
CopyBundlesToStreamingAssets(bundlesToCopy);
}
...
}
Resourcesからアセットバンドルへの変更
public class spawnCarFromBuiltinAssetBundle : MonoBehaviour
{
public string carName;
public string carBundleName;
IEnumerator Start ()
{
if(!string.IsNullOrEmpty(carBundleName))
{
var bundleReq = AssetBundle.LoadFromFileAsync(carBundleName);
yield return bundleReq;
var bundle = bundleReq.assetBundle;
if( bundle != null)
{
var assetReq = bundle.LoadAssetAsync(carName);
yield return assetReq;
if(assetReq.asset != null)
GameObject.Instantiate(assetReq.asset, this.transform,
false);
}
}
}
}
そして3ヶ月後 ...
Asset BundlesをCDNからロードするよう書き換え
public class spawnCarFromRemoteAssetBundle : MonoBehaviour
{
public string carName;
public string carBundleName;
public string remoteUrl;
IEnumerator Start ()
{
var bundleUrl = Path.Combine(remoteUrl, carBundleName);
var webReq = UnityWebRequest.GetAssetBundle(bundleUrl);
var handler = webReq.downloadHandler as DownloadHandlerAssetBundle;
yield return webReq.Send();
var bundle = handler.assetBundle;
if(bundle != null)
{
var prefab = bundle.LoadAsset<GameObject>(carName);
if(prefab != null)
GameObject.Instantiate(prefab, this.transform, false);
}
}
}
Loading Asset Bundles from CDN
public class spawnCarFromRemoteAssetBundle : MonoBehaviour
{
public string carName;
public string carBundleName;
public string remoteUrl;
IEnumerator Start ()
{
var bundleUrl = Path.Combine(remoteUrl, carBundleName);
var webReq = UnityWebRequest.GetAssetBundle(bundleUrl);
var handler = webReq.downloadHandler as DownloadHandlerAssetBundle;
yield return webReq.Send();
var bundle = handler.assetBundle;
if(bundle != null)
{
var prefab = bundle.LoadAsset<GameObject>(carName);
if(prefab != null)
GameObject.Instantiate(prefab, this.transform, false);
}
}
}
こ
ん
な
コ
ー
ド
じ
ゃ
無
理
!
!
public class spawnCarFromRemoteAssetBundleWithDependencies : MonoBehaviour
{
// Simple class to handle loading asset bundles via UnityWebRequest
public class AssetBundleLoader
{
string uri;
string bundleName;
public AssetBundle assetBundle
{
get; private set;
}
public static AssetBundleLoader Factory(string uri, string bundleName)
{
return new AssetBundleLoader(uri, bundleName);
}
private AssetBundleLoader(string uri, string bundleName)
{
this.uri = uri;
this.bundleName = bundleName;
}
public IEnumerator Load()
{
var bundleUrl = Path.Combine(this.uri, this.bundleName);
var webReq = UnityWebRequest.GetAssetBundle(bundleUrl);
var handler = webReq.downloadHandler as
DownloadHandlerAssetBundle;
yield return webReq.Send();
assetBundle = handler.assetBundle;
}
}
public string carName;
public string carBundleName;
public string manifestName;
public string remoteUrl;
IEnumerator Start ()
{
var manifestLoader = AssetBundleLoader.Factory(remoteUrl,
bundleManifestName);
yield return manifestLoader.Load();
var manifestBundle = manifestLoader.assetBundle;
// Bail out if we can't load the manifest
if(manifestBundle == null)
{
Debug.LogWarning("Could not load asset bundle manifest.");
yield break;
}
var op =
manifestBundle.LoadAssetAsync<AssetBundleManifest>("AssetBundleManifest");
yield return op;
var manifest = op.asset as AssetBundleManifest;
var deps = manifest.GetAllDependencies(carBundleName);
foreach(var dep in deps)
{
Debug.LogFormat("Loading asset bundle dependency {0}", dep);
var loader = AssetBundleLoader.Factory(remoteUrl, dep);
yield return loader.Load();
}
var carLoader = AssetBundleLoader.Factory(remoteUrl, carBundleName);
yield return carLoader.Load();
if(carLoader.assetBundle != null)
{
op = carLoader.assetBundle.LoadAssetAsync<GameObject>(carName);
yield return op;
var prefab = op.asset as GameObject;
if(prefab != null)
GameObject.Instantiate(prefab, this.transform, false);
}
}
}
さらに求められる、アセットバンドルに必要な配慮:
• 一番効率的にアセットをバンドルに含める方法
• バンドル内のアセット重複回避
• バンドルに含まれているアセットの管理・確認
• バンドルのロードのメモリ管理


• 

•


•
•
•
•
•
•
•
T


- heszkeWmeszke
•
•
•
•
•
•
•
•
•
•
•
•
•
• 

•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
Unity 2017.1b (experimental)
https://github.com/Unity-Technologies/AssetBundles-BuildPipeline
UnityEditor.Experimental.Build.AssetBundle

Bundle Build Pipeline Overhaul Sneak Peak
public static AssetBundleBuildInput
GenerateAssetBundleBuildInput(
AssetBundleBuildSettings settings) { … }
public struct AssetBundleBuildInput
{
public struct Definition
{
public string name;
public string variant;
public GUID[] assets;
}
public AssetBundleBuildSettings settings;
public Definition[] bundles;
}
* Input generated from asset importer meta
data or any other source (external tools, etc.)


Bundle Build Pipeline Overhaul Sneak Peak
public static AssetBundleBuildCommandSet
GenerateAssetBuildCommandSet(
AssetBundleBuildInput buildInput) { … }
public struct AssetBundleBuildCommandSet
{
public struct Command
{
public AssetBundleBuildInput.Definition input;
public ObjectIdentifier[] objectsToBeWritten;
}
public AssetBundleBuildSettings settings;
public Command[] commands;
}
Command set generation gathers all
dependencies, handles object stripping, and
generates full list of objects to write.


Bundle Build Pipeline Overhaul Sneak Peak
public static void SaveAssetBundleOutput(AssetBundleBuildOutput output) { … }
Output can be serialized to JSON or any other
format as required.
Bundle Build Pipeline Overhaul Sneak Peak
public static void SaveAssetBundleOutput(AssetBundleBuildOutput output) { … }
Put it all together …
// Default build pipeline
SaveAssetBundleOutput(ExecuteAssetBuildCommandSet(GenerateAssetBuildComma
ndSet(GenerateAssetBundleBuildInput(settings))));

Unity 2017.1b
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
public class spawnCarFromRemoteAssetBundleWithDependencies : MonoBehaviour
{
// Simple class to handle loading asset bundles via UnityWebRequest
public class AssetBundleLoader
{
string uri;
string bundleName;
public AssetBundle assetBundle
{
get; private set;
}
public static AssetBundleLoader Factory(string uri, string bundleName)
{
return new AssetBundleLoader(uri, bundleName);
}
private AssetBundleLoader(string uri, string bundleName)
{
this.uri = uri;
this.bundleName = bundleName;
}
public IEnumerator Load()
{
var bundleUrl = Path.Combine(this.uri, this.bundleName);
var webReq = UnityWebRequest.GetAssetBundle(bundleUrl);
var handler = webReq.downloadHandler as
DownloadHandlerAssetBundle;
yield return webReq.Send();
assetBundle = handler.assetBundle;
}
}
public string carName;
public string carBundleName;
public string manifestName;
public string remoteUrl;
IEnumerator Start ()
{
var manifestLoader = AssetBundleLoader.Factory(remoteUrl,
bundleManifestName);
yield return manifestLoader.Load();
var manifestBundle = manifestLoader.assetBundle;
// Bail out if we can't load the manifest
if(manifestBundle == null)
{
Debug.LogWarning("Could not load asset bundle manifest.");
yield break;
}
var op =
manifestBundle.LoadAssetAsync<AssetBundleManifest>("AssetBundleManifest");
yield return op;
var manifest = op.asset as AssetBundleManifest;
var deps = manifest.GetAllDependencies(carBundleName);
foreach(var dep in deps)
{
Debug.LogFormat("Loading asset bundle dependency {0}", dep);
var loader = AssetBundleLoader.Factory(remoteUrl, dep);
yield return loader.Load();
}
var carLoader = AssetBundleLoader.Factory(remoteUrl, carBundleName);
yield return carLoader.Load();
if(carLoader.assetBundle != null)
{
op = carLoader.assetBundle.LoadAssetAsync<GameObject>(carName);
yield return op;
var prefab = op.asset as GameObject;
if(prefab != null)
GameObject.Instantiate(prefab, this.transform, false);
}
}
}
public class spawnCarFromRemoteAssetBundleWithDependencies : MonoBehaviour
{
// Simple class to handle loading asset bundles via UnityWebRequest
public class AssetBundleLoader
{
string uri;
string bundleName;
public AssetBundle assetBundle
{
get; private set;
}
public static AssetBundleLoader Factory(string uri, string bundleName)
{
return new AssetBundleLoader(uri, bundleName);
}
private AssetBundleLoader(string uri, string bundleName)
{
this.uri = uri;
this.bundleName = bundleName;
}
public IEnumerator Load()
{
var bundleUrl = Path.Combine(this.uri, this.bundleName);
var webReq = UnityWebRequest.GetAssetBundle(bundleUrl);
var handler = webReq.downloadHandler as
DownloadHandlerAssetBundle;
yield return webReq.Send();
assetBundle = handler.assetBundle;
}
}
public string carName;
public string carBundleName;
public string manifestName;
public string remoteUrl;
IEnumerator Start ()
{
var manifestLoader = AssetBundleLoader.Factory(remoteUrl,
bundleManifestName);
yield return manifestLoader.Load();
var manifestBundle = manifestLoader.assetBundle;
// Bail out if we can't load the manifest
if(manifestBundle == null)
{
Debug.LogWarning("Could not load asset bundle manifest.");
yield break;
}
var op =
manifestBundle.LoadAssetAsync<AssetBundleManifest>("AssetBundleManifest");
yield return op;
var manifest = op.asset as AssetBundleManifest;
var deps = manifest.GetAllDependencies(carBundleName);
foreach(var dep in deps)
{
Debug.LogFormat("Loading asset bundle dependency {0}", dep);
var loader = AssetBundleLoader.Factory(remoteUrl, dep);
yield return loader.Load();
}
var carLoader = AssetBundleLoader.Factory(remoteUrl, carBundleName);
yield return carLoader.Load();
if(carLoader.assetBundle != null)
{
op = carLoader.assetBundle.LoadAssetAsync<GameObject>(carName);
yield return op;
var prefab = op.asset as GameObject;
if(prefab != null)
GameObject.Instantiate(prefab, this.transform, false);
}
}
}
public class spawnCarFromResourcesAsync : MonoBehaviour
{
public string carName;
IEnumerator Start ()
{
var req = Resources.LoadAsync(carName);
yield return req;
if(req.asset != null)
GameObject.Instantiate(req.asset, this.transform, false);
}
}
•
•
•
•
•
•
• 

• 

•
•
•
•
•
✓ 

✓
✓
✓


★
★


【Unite 2017 Tokyo】もっと気軽に、動的なコンテンツ配信を ~アセットバンドルの未来と開発ロードマップ

More Related Content

What's hot

Beginning icloud development - Cesare Rocchi - WhyMCA
Beginning icloud development - Cesare Rocchi - WhyMCABeginning icloud development - Cesare Rocchi - WhyMCA
Beginning icloud development - Cesare Rocchi - WhyMCA
Whymca
 
Getting Started with Datatsax .Net Driver
Getting Started with Datatsax .Net DriverGetting Started with Datatsax .Net Driver
Getting Started with Datatsax .Net Driver
DataStax Academy
 
Multithreading and Parallelism on iOS [MobOS 2013]
 Multithreading and Parallelism on iOS [MobOS 2013] Multithreading and Parallelism on iOS [MobOS 2013]
Multithreading and Parallelism on iOS [MobOS 2013]
Kuba Břečka
 
Java Concurrency in Practice
Java Concurrency in PracticeJava Concurrency in Practice
Java Concurrency in Practice
ericbeyeler
 
JJUG CCC 2011 Spring
JJUG CCC 2011 SpringJJUG CCC 2011 Spring
JJUG CCC 2011 Spring
Kiyotaka Oku
 
mDevCamp - The Best from Google IO
mDevCamp - The Best from Google IOmDevCamp - The Best from Google IO
mDevCamp - The Best from Google IO
ondraz
 
YUI3 Modules
YUI3 ModulesYUI3 Modules
YUI3 Modules
a_pipkin
 

What's hot (20)

Performance #1: Memory
Performance #1: MemoryPerformance #1: Memory
Performance #1: Memory
 
iOS Memory Management Basics
iOS Memory Management BasicsiOS Memory Management Basics
iOS Memory Management Basics
 
Beginning icloud development - Cesare Rocchi - WhyMCA
Beginning icloud development - Cesare Rocchi - WhyMCABeginning icloud development - Cesare Rocchi - WhyMCA
Beginning icloud development - Cesare Rocchi - WhyMCA
 
Getting Started with Datatsax .Net Driver
Getting Started with Datatsax .Net DriverGetting Started with Datatsax .Net Driver
Getting Started with Datatsax .Net Driver
 
Persisting Data on SQLite using Room
Persisting Data on SQLite using RoomPersisting Data on SQLite using Room
Persisting Data on SQLite using Room
 
Multithreading and Parallelism on iOS [MobOS 2013]
 Multithreading and Parallelism on iOS [MobOS 2013] Multithreading and Parallelism on iOS [MobOS 2013]
Multithreading and Parallelism on iOS [MobOS 2013]
 
Event driven javascript
Event driven javascriptEvent driven javascript
Event driven javascript
 
Java Concurrency in Practice
Java Concurrency in PracticeJava Concurrency in Practice
Java Concurrency in Practice
 
JJUG CCC 2011 Spring
JJUG CCC 2011 SpringJJUG CCC 2011 Spring
JJUG CCC 2011 Spring
 
mDevCamp - The Best from Google IO
mDevCamp - The Best from Google IOmDevCamp - The Best from Google IO
mDevCamp - The Best from Google IO
 
Kotlin is charming; The reasons Java engineers should start Kotlin.
Kotlin is charming; The reasons Java engineers should start Kotlin.Kotlin is charming; The reasons Java engineers should start Kotlin.
Kotlin is charming; The reasons Java engineers should start Kotlin.
 
Aplicações assíncronas no Android com
Coroutines & Jetpack
Aplicações assíncronas no Android com
Coroutines & JetpackAplicações assíncronas no Android com
Coroutines & Jetpack
Aplicações assíncronas no Android com
Coroutines & Jetpack
 
Mattbrenner
MattbrennerMattbrenner
Mattbrenner
 
Mastering Kotlin Standard Library
Mastering Kotlin Standard LibraryMastering Kotlin Standard Library
Mastering Kotlin Standard Library
 
Aplicações assíncronas no Android com Coroutines & Jetpack
Aplicações assíncronas no Android com Coroutines & JetpackAplicações assíncronas no Android com Coroutines & Jetpack
Aplicações assíncronas no Android com Coroutines & Jetpack
 
Aplicações assíncronas no Android com
Coroutines & Jetpack
Aplicações assíncronas no Android com
Coroutines & JetpackAplicações assíncronas no Android com
Coroutines & Jetpack
Aplicações assíncronas no Android com
Coroutines & Jetpack
 
Droidjam 2019 flutter isolates pdf
Droidjam 2019 flutter isolates pdfDroidjam 2019 flutter isolates pdf
Droidjam 2019 flutter isolates pdf
 
Rapid web development using tornado web and mongodb
Rapid web development using tornado web and mongodbRapid web development using tornado web and mongodb
Rapid web development using tornado web and mongodb
 
YUI3 Modules
YUI3 ModulesYUI3 Modules
YUI3 Modules
 
Objective C Memory Management
Objective C Memory ManagementObjective C Memory Management
Objective C Memory Management
 

Viewers also liked

Viewers also liked (20)

【Unity道場スペシャル 2017京都】最適化をする前に覚えておきたい技術
【Unity道場スペシャル 2017京都】最適化をする前に覚えておきたい技術【Unity道場スペシャル 2017京都】最適化をする前に覚えておきたい技術
【Unity道場スペシャル 2017京都】最適化をする前に覚えておきたい技術
 
【Unite 2017 Tokyo】スマートフォンでどこまでできる?3Dゲームをぐりぐり動かすテクニック講座
【Unite 2017 Tokyo】スマートフォンでどこまでできる?3Dゲームをぐりぐり動かすテクニック講座【Unite 2017 Tokyo】スマートフォンでどこまでできる?3Dゲームをぐりぐり動かすテクニック講座
【Unite 2017 Tokyo】スマートフォンでどこまでできる?3Dゲームをぐりぐり動かすテクニック講座
 
【Unite 2017 Tokyo】Unity Ads/Analytics/IAPを使ったマネタイゼーションの最適化とベストプラクティス
【Unite 2017 Tokyo】Unity Ads/Analytics/IAPを使ったマネタイゼーションの最適化とベストプラクティス【Unite 2017 Tokyo】Unity Ads/Analytics/IAPを使ったマネタイゼーションの最適化とベストプラクティス
【Unite 2017 Tokyo】Unity Ads/Analytics/IAPを使ったマネタイゼーションの最適化とベストプラクティス
 
【Unity道場スペシャル 2017京都】トゥーンシェーダー・マニアクス2
【Unity道場スペシャル 2017京都】トゥーンシェーダー・マニアクス2【Unity道場スペシャル 2017京都】トゥーンシェーダー・マニアクス2
【Unity道場スペシャル 2017京都】トゥーンシェーダー・マニアクス2
 
Unity and Azure Mobile Services using Prime31 plugin
Unity and Azure Mobile Services using Prime31 pluginUnity and Azure Mobile Services using Prime31 plugin
Unity and Azure Mobile Services using Prime31 plugin
 
【Unite 2017 Tokyo】新アセットバンドルツール詳解:アセット設定とアセットバンドルのワークフローを簡単に
【Unite 2017 Tokyo】新アセットバンドルツール詳解:アセット設定とアセットバンドルのワークフローを簡単に【Unite 2017 Tokyo】新アセットバンドルツール詳解:アセット設定とアセットバンドルのワークフローを簡単に
【Unite 2017 Tokyo】新アセットバンドルツール詳解:アセット設定とアセットバンドルのワークフローを簡単に
 
【Unite 2017 Tokyo】ゲーム開発を教えるツールとしてのUnity
【Unite 2017 Tokyo】ゲーム開発を教えるツールとしてのUnity【Unite 2017 Tokyo】ゲーム開発を教えるツールとしてのUnity
【Unite 2017 Tokyo】ゲーム開発を教えるツールとしてのUnity
 
【Unite 2017 Tokyo】ゲームAI・ゲームデザインから考えるゲームの過去・現在・未来
【Unite 2017 Tokyo】ゲームAI・ゲームデザインから考えるゲームの過去・現在・未来【Unite 2017 Tokyo】ゲームAI・ゲームデザインから考えるゲームの過去・現在・未来
【Unite 2017 Tokyo】ゲームAI・ゲームデザインから考えるゲームの過去・現在・未来
 
はじめようMixed Reality Immersive編
はじめようMixed Reality Immersive編はじめようMixed Reality Immersive編
はじめようMixed Reality Immersive編
 
【Unity道場スペシャル 2017大阪】カッコいい文字を使おう、そうText meshならね
【Unity道場スペシャル 2017大阪】カッコいい文字を使おう、そうText meshならね【Unity道場スペシャル 2017大阪】カッコいい文字を使おう、そうText meshならね
【Unity道場スペシャル 2017大阪】カッコいい文字を使おう、そうText meshならね
 
【Unity道場 2017】ゲーム開発者のためのタイポグラフィ講座
【Unity道場 2017】ゲーム開発者のためのタイポグラフィ講座【Unity道場 2017】ゲーム開発者のためのタイポグラフィ講座
【Unity道場 2017】ゲーム開発者のためのタイポグラフィ講座
 
【Unity道場スペシャル 2017札幌】超初心者向け!Unityのオーディオ機能を使ってみよう
【Unity道場スペシャル 2017札幌】超初心者向け!Unityのオーディオ機能を使ってみよう【Unity道場スペシャル 2017札幌】超初心者向け!Unityのオーディオ機能を使ってみよう
【Unity道場スペシャル 2017札幌】超初心者向け!Unityのオーディオ機能を使ってみよう
 
【Unity道場 2017】伝える!伝わる!フォント表現入門
【Unity道場 2017】伝える!伝わる!フォント表現入門【Unity道場 2017】伝える!伝わる!フォント表現入門
【Unity道場 2017】伝える!伝わる!フォント表現入門
 
【Unity道場スペシャル 2017札幌】乱数完全マスター
【Unity道場スペシャル 2017札幌】乱数完全マスター 【Unity道場スペシャル 2017札幌】乱数完全マスター
【Unity道場スペシャル 2017札幌】乱数完全マスター
 
【Unity道場スペシャル 2017京都】乱数完全マスター 京都編
【Unity道場スペシャル 2017京都】乱数完全マスター 京都編【Unity道場スペシャル 2017京都】乱数完全マスター 京都編
【Unity道場スペシャル 2017京都】乱数完全マスター 京都編
 
【Unite 2017 Tokyo】インスタンシングを用いた美麗なグラフィックの実現方法
【Unite 2017 Tokyo】インスタンシングを用いた美麗なグラフィックの実現方法【Unite 2017 Tokyo】インスタンシングを用いた美麗なグラフィックの実現方法
【Unite 2017 Tokyo】インスタンシングを用いた美麗なグラフィックの実現方法
 
【Unite 2017 Tokyo】新アセットバンドルツール詳解:アセット設定とアセットバンドルのワークフローを簡単に
【Unite 2017 Tokyo】新アセットバンドルツール詳解:アセット設定とアセットバンドルのワークフローを簡単に【Unite 2017 Tokyo】新アセットバンドルツール詳解:アセット設定とアセットバンドルのワークフローを簡単に
【Unite 2017 Tokyo】新アセットバンドルツール詳解:アセット設定とアセットバンドルのワークフローを簡単に
 
【Unity道場スペシャル 2017博多】TextMesh Pro を使いこなす
【Unity道場スペシャル 2017博多】TextMesh Pro を使いこなす【Unity道場スペシャル 2017博多】TextMesh Pro を使いこなす
【Unity道場スペシャル 2017博多】TextMesh Pro を使いこなす
 
AssetBundle (もどき) の作り方
AssetBundle (もどき) の作り方AssetBundle (もどき) の作り方
AssetBundle (もどき) の作り方
 
【Unity】今日から使えるTimeline
【Unity】今日から使えるTimeline【Unity】今日から使えるTimeline
【Unity】今日から使えるTimeline
 

Similar to 【Unite 2017 Tokyo】もっと気軽に、動的なコンテンツ配信を ~アセットバンドルの未来と開発ロードマップ

The Open Web and what it means
The Open Web and what it meansThe Open Web and what it means
The Open Web and what it means
Robert Nyman
 
Overview of Android Infrastructure
Overview of Android InfrastructureOverview of Android Infrastructure
Overview of Android Infrastructure
Alexey Buzdin
 
Overview of Android Infrastructure
Overview of Android InfrastructureOverview of Android Infrastructure
Overview of Android Infrastructure
C.T.Co
 
JavaScript APIs - The Web is the Platform - MDN Hack Day, Sao Paulo
JavaScript APIs - The Web is the Platform - MDN Hack Day, Sao PauloJavaScript APIs - The Web is the Platform - MDN Hack Day, Sao Paulo
JavaScript APIs - The Web is the Platform - MDN Hack Day, Sao Paulo
Robert Nyman
 
JavaScript APIs - The Web is the Platform - MozCamp, Buenos Aires
JavaScript APIs - The Web is the Platform - MozCamp, Buenos AiresJavaScript APIs - The Web is the Platform - MozCamp, Buenos Aires
JavaScript APIs - The Web is the Platform - MozCamp, Buenos Aires
Robert Nyman
 
JavaScript APIs - The Web is the Platform - MDN Hack Day, Santiago, Chile
JavaScript APIs - The Web is the Platform - MDN Hack Day, Santiago, ChileJavaScript APIs - The Web is the Platform - MDN Hack Day, Santiago, Chile
JavaScript APIs - The Web is the Platform - MDN Hack Day, Santiago, Chile
Robert Nyman
 
JavaScript APIs - The Web is the Platform - MDN Hack Day, Montevideo
JavaScript APIs - The Web is the Platform - MDN Hack Day, MontevideoJavaScript APIs - The Web is the Platform - MDN Hack Day, Montevideo
JavaScript APIs - The Web is the Platform - MDN Hack Day, Montevideo
Robert Nyman
 
Spring Orielly
Spring OriellySpring Orielly
Spring Orielly
jbashask
 
Android Studio Assignment HelpCan someone who is familiar with And.pdf
Android Studio Assignment HelpCan someone who is familiar with And.pdfAndroid Studio Assignment HelpCan someone who is familiar with And.pdf
Android Studio Assignment HelpCan someone who is familiar with And.pdf
feelinggift
 

Similar to 【Unite 2017 Tokyo】もっと気軽に、動的なコンテンツ配信を ~アセットバンドルの未来と開発ロードマップ (20)

Android workshop
Android workshopAndroid workshop
Android workshop
 
Android Loaders : Reloaded
Android Loaders : ReloadedAndroid Loaders : Reloaded
Android Loaders : Reloaded
 
Pathfinding - Part 2: Examples in Unity
Pathfinding - Part 2: Examples in UnityPathfinding - Part 2: Examples in Unity
Pathfinding - Part 2: Examples in Unity
 
Construire une application JavaFX 8 avec gradle
Construire une application JavaFX 8 avec gradleConstruire une application JavaFX 8 avec gradle
Construire une application JavaFX 8 avec gradle
 
Introduction to CQRS and Event Sourcing
Introduction to CQRS and Event SourcingIntroduction to CQRS and Event Sourcing
Introduction to CQRS and Event Sourcing
 
4.Spring IoC&DI(Spring Ioc실습_어노테이션 기반)
4.Spring IoC&DI(Spring Ioc실습_어노테이션 기반)4.Spring IoC&DI(Spring Ioc실습_어노테이션 기반)
4.Spring IoC&DI(Spring Ioc실습_어노테이션 기반)
 
The Open Web and what it means
The Open Web and what it meansThe Open Web and what it means
The Open Web and what it means
 
03 page navigation and data binding in windows runtime apps
03   page navigation and data binding in windows runtime apps03   page navigation and data binding in windows runtime apps
03 page navigation and data binding in windows runtime apps
 
Android Concurrency Presentation
Android Concurrency PresentationAndroid Concurrency Presentation
Android Concurrency Presentation
 
Pro typescript.ch03.Object Orientation in TypeScript
Pro typescript.ch03.Object Orientation in TypeScriptPro typescript.ch03.Object Orientation in TypeScript
Pro typescript.ch03.Object Orientation in TypeScript
 
The evolution of asynchronous JavaScript
The evolution of asynchronous JavaScriptThe evolution of asynchronous JavaScript
The evolution of asynchronous JavaScript
 
Overview of Android Infrastructure
Overview of Android InfrastructureOverview of Android Infrastructure
Overview of Android Infrastructure
 
Overview of Android Infrastructure
Overview of Android InfrastructureOverview of Android Infrastructure
Overview of Android Infrastructure
 
JavaScript APIs - The Web is the Platform - MDN Hack Day, Sao Paulo
JavaScript APIs - The Web is the Platform - MDN Hack Day, Sao PauloJavaScript APIs - The Web is the Platform - MDN Hack Day, Sao Paulo
JavaScript APIs - The Web is the Platform - MDN Hack Day, Sao Paulo
 
JavaScript APIs - The Web is the Platform - MozCamp, Buenos Aires
JavaScript APIs - The Web is the Platform - MozCamp, Buenos AiresJavaScript APIs - The Web is the Platform - MozCamp, Buenos Aires
JavaScript APIs - The Web is the Platform - MozCamp, Buenos Aires
 
JavaScript APIs - The Web is the Platform - MDN Hack Day, Santiago, Chile
JavaScript APIs - The Web is the Platform - MDN Hack Day, Santiago, ChileJavaScript APIs - The Web is the Platform - MDN Hack Day, Santiago, Chile
JavaScript APIs - The Web is the Platform - MDN Hack Day, Santiago, Chile
 
JavaScript APIs - The Web is the Platform - MDN Hack Day, Montevideo
JavaScript APIs - The Web is the Platform - MDN Hack Day, MontevideoJavaScript APIs - The Web is the Platform - MDN Hack Day, Montevideo
JavaScript APIs - The Web is the Platform - MDN Hack Day, Montevideo
 
Unittests für Dummies
Unittests für DummiesUnittests für Dummies
Unittests für Dummies
 
Spring Orielly
Spring OriellySpring Orielly
Spring Orielly
 
Android Studio Assignment HelpCan someone who is familiar with And.pdf
Android Studio Assignment HelpCan someone who is familiar with And.pdfAndroid Studio Assignment HelpCan someone who is familiar with And.pdf
Android Studio Assignment HelpCan someone who is familiar with And.pdf
 

More from Unity Technologies Japan K.K.

More from Unity Technologies Japan K.K. (20)

建築革命、更に更に進化!便利さ向上【Unity Reflect ver 3.0 】
建築革命、更に更に進化!便利さ向上【Unity Reflect ver 3.0 】建築革命、更に更に進化!便利さ向上【Unity Reflect ver 3.0 】
建築革命、更に更に進化!便利さ向上【Unity Reflect ver 3.0 】
 
UnityのクラッシュをBacktraceでデバッグしよう!
UnityのクラッシュをBacktraceでデバッグしよう!UnityのクラッシュをBacktraceでデバッグしよう!
UnityのクラッシュをBacktraceでデバッグしよう!
 
Unityで始めるバーチャルプロダクション
Unityで始めるバーチャルプロダクションUnityで始めるバーチャルプロダクション
Unityで始めるバーチャルプロダクション
 
ビジュアルスクリプティング (旧:Bolt) で始めるUnity入門3日目 ゲームをカスタマイズしよう
ビジュアルスクリプティング (旧:Bolt) で始めるUnity入門3日目 ゲームをカスタマイズしようビジュアルスクリプティング (旧:Bolt) で始めるUnity入門3日目 ゲームをカスタマイズしよう
ビジュアルスクリプティング (旧:Bolt) で始めるUnity入門3日目 ゲームをカスタマイズしよう
 
ビジュアルスクリプティングで始めるUnity入門2日目 ゴールとスコアの仕組み - Unityステーション
ビジュアルスクリプティングで始めるUnity入門2日目 ゴールとスコアの仕組み - Unityステーションビジュアルスクリプティングで始めるUnity入門2日目 ゴールとスコアの仕組み - Unityステーション
ビジュアルスクリプティングで始めるUnity入門2日目 ゴールとスコアの仕組み - Unityステーション
 
ビジュアルスクリプティングで始めるUnity入門1日目 プレイヤーを動かそう
ビジュアルスクリプティングで始めるUnity入門1日目 プレイヤーを動かそうビジュアルスクリプティングで始めるUnity入門1日目 プレイヤーを動かそう
ビジュアルスクリプティングで始めるUnity入門1日目 プレイヤーを動かそう
 
PlasticSCMの活用テクニックをハンズオンで一緒に学ぼう!
PlasticSCMの活用テクニックをハンズオンで一緒に学ぼう!PlasticSCMの活用テクニックをハンズオンで一緒に学ぼう!
PlasticSCMの活用テクニックをハンズオンで一緒に学ぼう!
 
点群を使いこなせ! 可視化なんて当たり前、xRと点群を組み合わせたUnityの世界 【Interact , Stipple】
点群を使いこなせ! 可視化なんて当たり前、xRと点群を組み合わせたUnityの世界 【Interact , Stipple】点群を使いこなせ! 可視化なんて当たり前、xRと点群を組み合わせたUnityの世界 【Interact , Stipple】
点群を使いこなせ! 可視化なんて当たり前、xRと点群を組み合わせたUnityの世界 【Interact , Stipple】
 
Unity教える先生方注目!ティーチャートレーニングデイを体験しよう
Unity教える先生方注目!ティーチャートレーニングデイを体験しようUnity教える先生方注目!ティーチャートレーニングデイを体験しよう
Unity教える先生方注目!ティーチャートレーニングデイを体験しよう
 
「原神」におけるコンソールプラットフォーム開発
「原神」におけるコンソールプラットフォーム開発「原神」におけるコンソールプラットフォーム開発
「原神」におけるコンソールプラットフォーム開発
 
FANTASIANの明日使えない特殊テクニック教えます
FANTASIANの明日使えない特殊テクニック教えますFANTASIANの明日使えない特殊テクニック教えます
FANTASIANの明日使えない特殊テクニック教えます
 
インディーゲーム開発の現状と未来 2021
インディーゲーム開発の現状と未来 2021インディーゲーム開発の現状と未来 2021
インディーゲーム開発の現状と未来 2021
 
建築革命、更に進化!デジタルツイン基盤の真打ち登場【概要編 Unity Reflect ver 2.1 】
建築革命、更に進化!デジタルツイン基盤の真打ち登場【概要編 Unity Reflect ver 2.1 】建築革命、更に進化!デジタルツイン基盤の真打ち登場【概要編 Unity Reflect ver 2.1 】
建築革命、更に進化!デジタルツイン基盤の真打ち登場【概要編 Unity Reflect ver 2.1 】
 
Burstを使ってSHA-256のハッシュ計算を高速に行う話
Burstを使ってSHA-256のハッシュ計算を高速に行う話Burstを使ってSHA-256のハッシュ計算を高速に行う話
Burstを使ってSHA-256のハッシュ計算を高速に行う話
 
Cinemachineで見下ろし視点のカメラを作る
Cinemachineで見下ろし視点のカメラを作るCinemachineで見下ろし視点のカメラを作る
Cinemachineで見下ろし視点のカメラを作る
 
徹底解説 Unity Reflect【開発編 ver2.0】
徹底解説 Unity Reflect【開発編 ver2.0】徹底解説 Unity Reflect【開発編 ver2.0】
徹底解説 Unity Reflect【開発編 ver2.0】
 
徹底解説 Unity Reflect【概要編 ver2.0】
徹底解説 Unity Reflect【概要編 ver2.0】徹底解説 Unity Reflect【概要編 ver2.0】
徹底解説 Unity Reflect【概要編 ver2.0】
 
Unityティーチャートレーニングデイ -認定プログラマー編-
Unityティーチャートレーニングデイ -認定プログラマー編-Unityティーチャートレーニングデイ -認定プログラマー編-
Unityティーチャートレーニングデイ -認定プログラマー編-
 
Unityティーチャートレーニングデイ -認定3Dアーティスト編-
Unityティーチャートレーニングデイ -認定3Dアーティスト編-Unityティーチャートレーニングデイ -認定3Dアーティスト編-
Unityティーチャートレーニングデイ -認定3Dアーティスト編-
 
Unityティーチャートレーニングデイ -認定アソシエイト編-
Unityティーチャートレーニングデイ -認定アソシエイト編-Unityティーチャートレーニングデイ -認定アソシエイト編-
Unityティーチャートレーニングデイ -認定アソシエイト編-
 

Recently uploaded

EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
Earley Information Science
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
Joaquim Jorge
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
Enterprise Knowledge
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
giselly40
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
vu2urc
 

Recently uploaded (20)

Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 

【Unite 2017 Tokyo】もっと気軽に、動的なコンテンツ配信を ~アセットバンドルの未来と開発ロードマップ

  • 1.
  • 2.
  • 3.
  • 4.
  • 5.
  • 6.
  • 7.
  • 8.
  • 10.
  • 13.
  • 14.
  • 15. Unityプロジェクト 開発初週 - 直接参照 public class spawnCarFromDirectReference : MonoBehaviour { public GameObject carPrefab; void Start () { if(carPrefab != null) GameObject.Instantiate(carPrefab, this.transform, false); } }
  • 16. Unityプロジェクト,開発2週目 - Resources.Load public class spawnCarFromResources : MonoBehaviour { public string carName; void Start () { var go = Resources.Load<GameObject>(carName); if(go != null) GameObject.Instantiate(go, this.transform, false); } }
  • 17. Unityプロジェクト,開発3週目 - Resources.LoadAsync public class spawnCarFromResourcesAsync : MonoBehaviour { public string carName; IEnumerator Start () { var req = Resources.LoadAsync(carName); yield return req; if(req.asset != null) GameObject.Instantiate(req.asset, this.transform, false); } }
  • 19. Resourcesからアセットバンドルへの変更 public class MyBuildProcess { ... [MenuItem("Build/Build Asset Bundles")] public static void BuildAssetBundles() { var outputPath = bundleBuildPath; if(!Directory.Exists(outputPath)) Directory.CreateDirectory(outputPath); var manifest = BuildPipeline.BuildAssetBundles(outputPath, BuildAssetBundleOptions.ChunkBasedCompression, EditorUserBuildSettings.activeBuildTarget); var bundlesToCopy = new List<string>(manifest.GetAllAssetBundles()); // Copy the manifest file bundlesToCopy.Add(EditorUserBuildSettings.activeBuildTarget.ToString()); CopyBundlesToStreamingAssets(bundlesToCopy); } ... }
  • 20. Resourcesからアセットバンドルへの変更 public class spawnCarFromBuiltinAssetBundle : MonoBehaviour { public string carName; public string carBundleName; IEnumerator Start () { if(!string.IsNullOrEmpty(carBundleName)) { var bundleReq = AssetBundle.LoadFromFileAsync(carBundleName); yield return bundleReq; var bundle = bundleReq.assetBundle; if( bundle != null) { var assetReq = bundle.LoadAssetAsync(carName); yield return assetReq; if(assetReq.asset != null) GameObject.Instantiate(assetReq.asset, this.transform, false); } } } }
  • 22. Asset BundlesをCDNからロードするよう書き換え public class spawnCarFromRemoteAssetBundle : MonoBehaviour { public string carName; public string carBundleName; public string remoteUrl; IEnumerator Start () { var bundleUrl = Path.Combine(remoteUrl, carBundleName); var webReq = UnityWebRequest.GetAssetBundle(bundleUrl); var handler = webReq.downloadHandler as DownloadHandlerAssetBundle; yield return webReq.Send(); var bundle = handler.assetBundle; if(bundle != null) { var prefab = bundle.LoadAsset<GameObject>(carName); if(prefab != null) GameObject.Instantiate(prefab, this.transform, false); } } }
  • 23. Loading Asset Bundles from CDN public class spawnCarFromRemoteAssetBundle : MonoBehaviour { public string carName; public string carBundleName; public string remoteUrl; IEnumerator Start () { var bundleUrl = Path.Combine(remoteUrl, carBundleName); var webReq = UnityWebRequest.GetAssetBundle(bundleUrl); var handler = webReq.downloadHandler as DownloadHandlerAssetBundle; yield return webReq.Send(); var bundle = handler.assetBundle; if(bundle != null) { var prefab = bundle.LoadAsset<GameObject>(carName); if(prefab != null) GameObject.Instantiate(prefab, this.transform, false); } } } こ ん な コ ー ド じ ゃ 無 理 ! !
  • 24.
  • 25. public class spawnCarFromRemoteAssetBundleWithDependencies : MonoBehaviour { // Simple class to handle loading asset bundles via UnityWebRequest public class AssetBundleLoader { string uri; string bundleName; public AssetBundle assetBundle { get; private set; } public static AssetBundleLoader Factory(string uri, string bundleName) { return new AssetBundleLoader(uri, bundleName); } private AssetBundleLoader(string uri, string bundleName) { this.uri = uri; this.bundleName = bundleName; } public IEnumerator Load() { var bundleUrl = Path.Combine(this.uri, this.bundleName); var webReq = UnityWebRequest.GetAssetBundle(bundleUrl); var handler = webReq.downloadHandler as DownloadHandlerAssetBundle; yield return webReq.Send(); assetBundle = handler.assetBundle; } } public string carName; public string carBundleName; public string manifestName; public string remoteUrl; IEnumerator Start () { var manifestLoader = AssetBundleLoader.Factory(remoteUrl, bundleManifestName); yield return manifestLoader.Load(); var manifestBundle = manifestLoader.assetBundle; // Bail out if we can't load the manifest if(manifestBundle == null) { Debug.LogWarning("Could not load asset bundle manifest."); yield break; } var op = manifestBundle.LoadAssetAsync<AssetBundleManifest>("AssetBundleManifest"); yield return op; var manifest = op.asset as AssetBundleManifest; var deps = manifest.GetAllDependencies(carBundleName); foreach(var dep in deps) { Debug.LogFormat("Loading asset bundle dependency {0}", dep); var loader = AssetBundleLoader.Factory(remoteUrl, dep); yield return loader.Load(); } var carLoader = AssetBundleLoader.Factory(remoteUrl, carBundleName); yield return carLoader.Load(); if(carLoader.assetBundle != null) { op = carLoader.assetBundle.LoadAssetAsync<GameObject>(carName); yield return op; var prefab = op.asset as GameObject; if(prefab != null) GameObject.Instantiate(prefab, this.transform, false); } } }
  • 27.
  • 28.
  • 31.
  • 32.
  • 34.
  • 35.
  • 36.
  • 45. Bundle Build Pipeline Overhaul Sneak Peak public static AssetBundleBuildInput GenerateAssetBundleBuildInput( AssetBundleBuildSettings settings) { … } public struct AssetBundleBuildInput { public struct Definition { public string name; public string variant; public GUID[] assets; } public AssetBundleBuildSettings settings; public Definition[] bundles; } * Input generated from asset importer meta data or any other source (external tools, etc.) 

  • 46. Bundle Build Pipeline Overhaul Sneak Peak public static AssetBundleBuildCommandSet GenerateAssetBuildCommandSet( AssetBundleBuildInput buildInput) { … } public struct AssetBundleBuildCommandSet { public struct Command { public AssetBundleBuildInput.Definition input; public ObjectIdentifier[] objectsToBeWritten; } public AssetBundleBuildSettings settings; public Command[] commands; } Command set generation gathers all dependencies, handles object stripping, and generates full list of objects to write. 

  • 47. Bundle Build Pipeline Overhaul Sneak Peak public static void SaveAssetBundleOutput(AssetBundleBuildOutput output) { … } Output can be serialized to JSON or any other format as required.
  • 48. Bundle Build Pipeline Overhaul Sneak Peak public static void SaveAssetBundleOutput(AssetBundleBuildOutput output) { … } Put it all together … // Default build pipeline SaveAssetBundleOutput(ExecuteAssetBuildCommandSet(GenerateAssetBuildComma ndSet(GenerateAssetBundleBuildInput(settings))));

  • 54.
  • 55. public class spawnCarFromRemoteAssetBundleWithDependencies : MonoBehaviour { // Simple class to handle loading asset bundles via UnityWebRequest public class AssetBundleLoader { string uri; string bundleName; public AssetBundle assetBundle { get; private set; } public static AssetBundleLoader Factory(string uri, string bundleName) { return new AssetBundleLoader(uri, bundleName); } private AssetBundleLoader(string uri, string bundleName) { this.uri = uri; this.bundleName = bundleName; } public IEnumerator Load() { var bundleUrl = Path.Combine(this.uri, this.bundleName); var webReq = UnityWebRequest.GetAssetBundle(bundleUrl); var handler = webReq.downloadHandler as DownloadHandlerAssetBundle; yield return webReq.Send(); assetBundle = handler.assetBundle; } } public string carName; public string carBundleName; public string manifestName; public string remoteUrl; IEnumerator Start () { var manifestLoader = AssetBundleLoader.Factory(remoteUrl, bundleManifestName); yield return manifestLoader.Load(); var manifestBundle = manifestLoader.assetBundle; // Bail out if we can't load the manifest if(manifestBundle == null) { Debug.LogWarning("Could not load asset bundle manifest."); yield break; } var op = manifestBundle.LoadAssetAsync<AssetBundleManifest>("AssetBundleManifest"); yield return op; var manifest = op.asset as AssetBundleManifest; var deps = manifest.GetAllDependencies(carBundleName); foreach(var dep in deps) { Debug.LogFormat("Loading asset bundle dependency {0}", dep); var loader = AssetBundleLoader.Factory(remoteUrl, dep); yield return loader.Load(); } var carLoader = AssetBundleLoader.Factory(remoteUrl, carBundleName); yield return carLoader.Load(); if(carLoader.assetBundle != null) { op = carLoader.assetBundle.LoadAssetAsync<GameObject>(carName); yield return op; var prefab = op.asset as GameObject; if(prefab != null) GameObject.Instantiate(prefab, this.transform, false); } } }
  • 56. public class spawnCarFromRemoteAssetBundleWithDependencies : MonoBehaviour { // Simple class to handle loading asset bundles via UnityWebRequest public class AssetBundleLoader { string uri; string bundleName; public AssetBundle assetBundle { get; private set; } public static AssetBundleLoader Factory(string uri, string bundleName) { return new AssetBundleLoader(uri, bundleName); } private AssetBundleLoader(string uri, string bundleName) { this.uri = uri; this.bundleName = bundleName; } public IEnumerator Load() { var bundleUrl = Path.Combine(this.uri, this.bundleName); var webReq = UnityWebRequest.GetAssetBundle(bundleUrl); var handler = webReq.downloadHandler as DownloadHandlerAssetBundle; yield return webReq.Send(); assetBundle = handler.assetBundle; } } public string carName; public string carBundleName; public string manifestName; public string remoteUrl; IEnumerator Start () { var manifestLoader = AssetBundleLoader.Factory(remoteUrl, bundleManifestName); yield return manifestLoader.Load(); var manifestBundle = manifestLoader.assetBundle; // Bail out if we can't load the manifest if(manifestBundle == null) { Debug.LogWarning("Could not load asset bundle manifest."); yield break; } var op = manifestBundle.LoadAssetAsync<AssetBundleManifest>("AssetBundleManifest"); yield return op; var manifest = op.asset as AssetBundleManifest; var deps = manifest.GetAllDependencies(carBundleName); foreach(var dep in deps) { Debug.LogFormat("Loading asset bundle dependency {0}", dep); var loader = AssetBundleLoader.Factory(remoteUrl, dep); yield return loader.Load(); } var carLoader = AssetBundleLoader.Factory(remoteUrl, carBundleName); yield return carLoader.Load(); if(carLoader.assetBundle != null) { op = carLoader.assetBundle.LoadAssetAsync<GameObject>(carName); yield return op; var prefab = op.asset as GameObject; if(prefab != null) GameObject.Instantiate(prefab, this.transform, false); } } }
  • 57. public class spawnCarFromResourcesAsync : MonoBehaviour { public string carName; IEnumerator Start () { var req = Resources.LoadAsync(carName); yield return req; if(req.asset != null) GameObject.Instantiate(req.asset, this.transform, false); } }
  • 58.
  • 63.
  • 64.
  • 65.
  • 67.
  • 68.