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

397 Views

June 06, 17

スライド概要

講演者:大前 広樹(ユニティ・テクノロジーズ・ジャパン合同会社)

こんな人におすすめ
・アセットバンドルを使用するゲームの開発に関わっているプログラマーの方
・Unityで動的なコンテンツ配信を実現したいプログラマーの方
・アセットを使用するエディター拡張等を開発しているプログラマーの方

受講者が得られる知見
・アセットバンドルのツールやAPIが今後どう変化していくか
現在のアセットバンドルの課題がどう解決されていくか
新しいアセットバンドルの環境下で何をUnityが解決し、何をコンテンツ開発者が解決すべき問題となるか

講演動画:https://youtu.be/Aenne9hh2Mw

profile-image

リアルタイム3Dコンテンツを制作・運用するための世界的にリードするプラットフォームである「Unity」の日本国内における販売、サポート、コミュニティ活動、研究開発、教育支援を行っています。ゲーム開発者からアーティスト、建築家、自動車デザイナー、映画製作者など、さまざまなクリエイターがUnityを使い想像力を発揮しています。

シェア

またはPlayer版

埋め込む »CMSなどでJSが使えない場合

関連スライド

各ページのテキスト
1.

‫׾⥋‪ꂁ‬خ‪ٝ‬ذ‪ٝ‬؝ז‪⹛涸‬ח‪孡鯪‬ה׏׮‬ ‫فحوس‪Ꟛ涪ٗ٦‬ה‪劢勻‬ךٕس‪ٝ‬غزحإ‪،‬‬

2.

)JSPLJ0NBF 3FHJPOBM%JSFDUPS 6OJUZ

3.

8"3/*/( "%7"/$&%4&44*0/ ")&"%

4.

‫ַךז‪⡦佦"%7"/$&%‬‬ ‫׮גְ‪耀‬׾‪ّٝ‬ءحإךֿ‬ ‫‪‬׿ׇת׶זכחֲ״׷ַⴓָ‪⢪ְ倯‬ךٕس‪ٝ‬غزحإ‪،‬‬ ‫(‪陨デ8"3/*/(陨デ8"3/*/‬‬

5.

‫‪湡涸‬ך‪ّٝ‬ءحإךֿ‬ ‫‪պ‬הֲֿ׵׮ג׏‪濼‬׾‪չ植朐‬‬ ‫‪պ‬הֿ׷ׅח‪㺁僒‬׾⪒‪㼎䘔彊‬חֹה׋׏ֿ‪չ㢌⻉ָ饯‬‬ ‫‪պ‬הֲֿ׵׮ג׃⸇⿫ח‪չꟚ涪‬‬ ‫(‪陨デ8"3/*/(陨デ8"3/*/‬‬

6.

‫‪կ‬ׅת׫‪㢳ֻろ‬׾‪ⰻ㺁‬ך⚥‪Ꟛ涪‬כ‪ّٝ‬ءحإ‬ ‫ה‪ְֲⰻ㺁‬ה‪պ‬ד׋׃ח‪չְֲֲֿ괏‬‬ ‫ָ‪ְֲⰻ㺁‬ה‪պ‬דװ׶׮א׷ׅח‪չְֲֲֿ괏‬‬ ‫‪կ‬ׅתְג׸ת‪⚕倯ろ‬‬ ‫(‪陨デ8"3/*/(陨デ8"3/*/‬‬

7.

‫׶׮א‬ ‫ד׋׃‬

8.

‫כחⴓ‪鿇‬ך‪պ‬׶׮א‪չ‬ח‪暴‬‬ ‫‪‬ׅתְג׭‪実‬׾ؙحغس‪٦‬؍ؿך׿ֻׁ׋ך׵ַ׿ׁ‪涺‬‬ ‫‪ְׁ‬׌ֻ⸂⼿׀ח‪Ꟛ涪‬מ׈‬ ‫(‪陨デ8"3/*/(陨デ8"3/*/‬‬

9.

問題を解決するときはいつも、もっとも抵抗の少 ない道を選んで行けばたやすく解決しそうに見え る。 しかして、その易しそうな道こそが最も過酷 で残酷なものに変質するのだ… -Winston Churchill

10.

‫כהٕس‪ٝ‬غزحإ‪،‬‬

11.

‫כהٕس‪ٝ‬غزحإ‪،‬‬ ‫ ך׮זֲ״ך‪ [JQ‬شذ‪ٝ‬؝׷ׅ‪呓秛‬׾زؙؑآـؔ •‬ ‫ؔ׷׸ׁؤ؎ٓ‪ٔ،‬ءדي؎ة‪⥂䭯ծٓٝ‬׾‪䞔㜠‬ך‪嫣‬ي‪ؓ٦‬ؿزحٓف •‬ ‫زؙؑآـ‬ ‫׷‪ָ⳿勻‬הֿא‪䭯‬׾⤘‪⣛㶷ꟼ‬ך‪ٕ꟦‬س‪ٝ‬غ •‬ ‫ ;‪ ꬊ㖇簭ծ-;."ծ-‬׷ָ֮‪ّٝ‬ءفؔך‪• 㖇簭‬‬ ‫׷ָ֮‪珏겲‬ךאך‪⟃㢩‬׸׉ה˒‪٦ٝ欽‬ء‪• ˑ‬‬ ‫س؎ؖ׷ׅ‪ꟼ‬חأ‪٦‬أהٕس‪ٝ‬غزحإ‪䗳铣،‬‬

12.

‫‪⢪ְ麣‬‬ ‫׷ֻׁׅ‪㼭‬׾ؤ؎؟ٕ‪٦‬زأ‪؎ٝ‬ךٔف‪،‬‬ ‫׷ׅ‪刿倜‬ח‪媮ꥡ涸‬أٖي‪٦‬ء׾خ‪ٝ‬ذ‪ٝ‬؝ךٔف‪،‬‬ ‫׷ׅ‪盖椚‬ח‪⿑㺘‬ה׏׮׾ًٌٔךي؎ة‪ٓ؎ٝ‬‬ ‫׷ׅ‪䲿⣘‬׾زحإ‪،‬׋׃⻉‪剑黝‬חؙحلأךأ؎غر‬ ‫׷ֻׅ‪鸞‬׾‪ّٝ‬ء‪ٖ٦‬ذ؎‪ծ‬ג׃‪何㊣‬׾‪儗꟦‬سٕؽךٔف‪،‬‬ ‫•‬ ‫•‬ ‫•‬ ‫•‬ ‫•‬

14.

‫˘ה׷‪鋅‬ג׏‪⢪‬ח‪㹋ꥷ‬‬

15.
[beta]
Unityプロジェクト 開発初週 - 直接参照

public class spawnCarFromDirectReference : MonoBehaviour
{
public GameObject carPrefab;
void Start ()
{
if(carPrefab != null)
GameObject.Instantiate(carPrefab, this.transform, false);
}
}

16.
[beta]
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.
[beta]
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);
}
}

18.

‫‪そして3ヶ月の時が流れた ...‬‬ ‫׷ֺׅ׶ַַָ‪儗꟦‬ח⹛‪饯‬ךي‪٦‬؜‪‬‬ ‫ְז‪ⵖ䖴⳿勻‬גְגְֺׅ‪⢪‬׾ًٌٔח‪˘㹋遤儗‬‬ ‫˘ֲ״׃חٕس‪ٝ‬غزحإ‪ծ،‬׌ֲ׉‬

19.
[beta]
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.
[beta]
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);
}
}
}
}

21.

そして3ヶ月後 ... ،‫؎ךٔف‬ٝ‫زأ‬٦ٕ㺁ꆀָ㣐ֹ‫׷ֺׅ‬ ‫ؐت‬ٝٗ٦‫؝س‬ٝ‫ذ‬ٝ‫ךخ‬㼎䘔ָ䗳銲‫׷זח‬

22.
[beta]
Asset BundlesをCDNからロードするよう書き換え

8FCַ‫ٗ׵‬٦‫חֲ״׷ׅس‬
剅ֹ䳔ִ‫׷‬䩛꟦‫כ‬㼰‫˘ְז‬

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.
[beta]
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.
[beta]
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);
}

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();
}

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();

var carLoader = AssetBundleLoader.Factory(remoteUrl, carBundleName);
yield return carLoader.Load();
if(carLoader.assetBundle != null)
{
op = carLoader.assetBundle.LoadAssetAsync<GameObject>(carName);
yield return op;

assetBundle = handler.assetBundle;
}

var prefab = op.asset as GameObject;

}
public
public
public
public

string
string
string
string

carName;
carBundleName;
manifestName;
remoteUrl;

IEnumerator Start ()
{
var manifestLoader = AssetBundleLoader.Factory(remoteUrl,
bundleManifestName);

if(prefab != null)
GameObject.Instantiate(prefab, this.transform, false);
}
}
}

26.

さらに求められる、アセットバンドルに必要な配慮: • 一番効率的にアセットをバンドルに含める方法 • バンドル内のアセット重複回避 • バンドルに含まれているアセットの管理・確認 • バンドルのロードのメモリ管理

28.

‫ךٕس‪ٝ‬غزحإ‪،‬‬ ‫‪㉏겗挿‬‬

29.

‫ٕس‪ٝ‬غزحإ‪ְ،‬غָֿֿَ‬ ‫‪ְկ‬ז׵ַ׻ַך׷‪椚鍑⳿勻‬ל׭‪ֲ铣‬ו׾‪ְկ⡦‬غָَز‪ًُٝ‬ؗس •‬ ‫חהֿ׷ׅ׾‪ٕ㼎䘔‬س‪ٝ‬غزحإ‪،‬ד‪穠卓ծꨜ㔲孡‬‬ ‫‪ⵃ欽‬ח‪㹋ꥷ‬ד‪ّٝ‬ءؙتٗف׾ٕس‪ٝ‬غزحإ‪կ،‬׷ֺׅٕكٖ‪• "1*ָ⡚‬‬ ‫ְז׵זל׸ֽזַ‪剅‬׿ֻׁ׋׾س‪٦‬؝ָ‪ծꟚ涪罏‬כח׭׋׷ׅ‬ ‫‪‬ز‪٦‬رفح‪،‬ה‪ٔ٦‬غٔرךخ‪ٝ‬ذ‪ٝ‬؝ח‪暴‬‬ ‫ז‪䗳銲‬ח‪ⵖ䖴‬ךس‪ٗ٦‬ן״ֶُءحٍؗ‪ծ‬سٕؽ‪կ‬׷ֺׅٕكٖ‪• "1*ָ넝‬‬ ‫‪ְկ‬זָ‪磛䏝‬זⴓ⼧‬ ‫‪٦‬خ‪٦٥‬ة؍رؒז‪䗳銲‬ח׭׋ךٕس‪ٝ‬غزحإ‪ְկ،‬غָَ‪• Ꟛ涪橆㞮‬‬ ‫‪ְկ‬זָٕ‬

30.

‫‪T‬‬ ‫‪ٕ竲ֹ‬س‪ٝ‬غزحإ‪ְ،‬غָֿֿَ‬ ‫ָ‪Ⳣ椚儗꟦‬ךس‪ٗ٦‬ג׏״חي‪ؓ٦‬ؿزحٓف‪ְկ‬غָَأ‪ٝ‬و‪ؓ٦‬ؿػ •‬ ‫‪Ⰻ搫麩ֲկ‬‬ ‫‪ְկ‬ז׋‪甧‬ח‪䕵‬ד‪ّٝ‬ءؙتٗفך‪ְկ㹋ꥷ‬غָَ‪• 7BSJBOU‬‬ ‫׾הֿך‪ָ"TTFU#VOEMF‬سٕؽךٔف‪ְկ،‬غָَ‪ְ堣腉‬זִ‪⢪‬ח‪• ♧筰‬‬ ‫ַא‪ָ鋅‬أؙٓז‪䗳銲‬ח‪儗‬س‪ٗ٦‬גְ⸬ָ‪$PEF4USJQQJOH‬דךְזג‪鋅‬‬ ‫׷ׅ׶׋׏זֻז׵‬ ‫ז׵זח‪⿫罋‬דךְ‪ָ⡚‬؍ذؙٔؔךٕف‪ٝ‬؟‪ְկ‬غָَس‪٦‬؝ٕف‪ٝ‬؟ •‬ ‫‪կ‬׷ֺׅ‪黝䔲‬׮أ‪ٝ‬شذ‪ًٝ‬׮ַ׃‪ծ‬׃ְ‬ ‫‪٥٥٥‬כ‪㉏겗‬ך‪剑㣐‬ג׃ַ׃ •‬

33.

ˑ6OJUZ‫״‬ծぢֹさֲ‫׌ך‬ ،‫غزحإ‬ٝ‫כٕس‬剑ⴱַ‫׵‬⡦‫׮ַ׮‬ ָ꟦麩ְ‫˒˘חהְֲֿה׋׏׌‬ ˑ-FUˏTGBDFJUVOJUZˊXIPMFBTTFUCVOEMFTUIJOHXBTNJTUBLFGSPNUIFCFHJOOJOH˒ - heszkeWmeszke

35.

‫‪պ‬׌‪ֲ㣐♱㣗‬׮‪‬׈׋‪ָ勻‬׍׋ٖؔ˘ז׋ׇ׋‪չ䖉‬‬

37.

‫‪⚺滙挿‬ךي‪٦‬ثٕس‪ٝ‬غزحإ‪،‬‬ ‫‪⥜姻‬ؚغה‪鍑寸‬ך⫈‪䪮遭涸頾‬‬ ‫‪䲿⣘‬ךٕ‪٦‬خ‪٦‬ة؍رؒ‬ ‫ٕ‪٦‬م‪٦‬غ‪ؔ٦‬ך*‪ٓ؎ٝ"1‬ف؎ػسٕؽٕس‪ٝ‬غزحإ‪،‬‬ ‫‪何㊣‬ך*‪"1‬ي؎ة‪ٓٝ‬ךس‪،ٝٗ٦‬س‪ٗ٦‬‬ ‫‪何㊣‬ך*‪ُ"1‬ءحٍؗ‬ ‫⪒‪侭‬ךز‪ًُٝ‬ؗس‬ ‫‪䲿⣘‬ךزؙؑآٗفٕف‪ٝ‬؟׷זח‪⿫罋‬ד⹡‪㹋‬‬ ‫•‬ ‫•‬ ‫•‬ ‫•‬ ‫•‬ ‫•‬ ‫•‬

38.

Ꟛ涪椚䙀΍ؔ٦‫ف‬ٝ‫ا‬٦‫דأ‬Ꟛ涪‫׷ׅ‬ • (JUIVC#JUCVDLFU‫ד‬鷲僇䚍‫׷֮ך‬Ꟛ涪‫׷ׅ׾‬ • 鸞ְ‫ة‬٦ٝ،ٓؐٝ‫س‬ • 㢳ֻ‫ג‬㼭ְׁ،‫رفح‬٦‫ز‬ • ‫ؙٕٔف‬٥‫هؚٖغ‬٦‫חز‬㼎‫׷ׅ‬琎噰涸‫هأٖז‬ٝ‫أ‬

39.

‫زأ‪؋٦‬ؿ‪Ꟛ涪椚䙀Ύ곁㹏‬‬ ‫‪ُ٦‬ؽة‪䞔㜠❛䳔ծ؎ٝ‬ךֻ‪㢳‬ה׏׮ה‪• Ꟛ涪罏‬‬ ‫‪⠓鑧‬ז‪琎噰涸‬ךדيٓ‪ؓ٦‬ؿ •‬ ‫ְֻג׏׵׮׾أ؎غس‪،‬ח‪琎噰涸‬ח‪ٓٝꟚ涪罏麦‬ذكך‪⠓爡‬ي‪٦‬؜ •‬ ‫س‪٦‬ن‪ٔ٦‬ؠ؎غس‪،‬‬

40.

䎃‫ך‬崞⹛ • • • • • 곁㹏‫؎ךפ‬ٝ‫ُؽة‬٦ծ㉏겗挿‫ך‬涪鋅‫ה‬侭椚 ㉏겗挿‫ך‬䱍䳢 ‫⥜ؚغ‬姻 ‫؎ٓف؎ػسٕؽ‬ٝ"1*‫ؔך‬٦‫غ‬٦‫م‬٦ٕ QSFWJFX  ؒ‫ة؍ر‬٦‫خ‬٦ٕ䲿⣘ • "TTFU#VOEMFT#SPXTFS QSFWJFX  • "TTFU#VOMEF(SBQI5PPM CFUB ‫ד׋׃‬

41.

䎃‫ך‬崞⹛ ‫ًُؗس‬ٝ‫ךز‬何㊣ "TTFU#VOEMF(SBQI5PPMٔٔ٦‫أ‬ "TTFU#VOEMFT#SPXTFSٔٔ٦‫أ‬ ꅾ銲‫⥜ؚغז‬姻 • TIBEFSWBSJBOUT㉏겗‫ך‬鍑寸BOE‫هؙحغ׮ח‬٦‫ ز‬ • "TTFU#VOEMF.BOJGFTU‫َ؎ٖف׾‬٦‫חسٕؽ‬䭷㹀〳腉‫ח‬   • ‫ؓؿػ‬٦‫و‬ٝ‫أ‬何㊣ • %95‫ٍثأؙذ‬㖇簭鸞䏝‫ך‬何㊣ • ،‫غزحإ‬ٝ‫ٗךٕس‬٦‫س‬儗꟦‫ך‬何㊣ • • • • ‫ד׋׃‬

42.

䎃2 • • • • • • • ‫؎ٓف؎ػسٕؽ‬ٝ"1*‫ؔך‬٦‫غ‬٦‫م‬٦ٕ CFUB  倜‫"ُءحٍؗ‬1* CFUB  "TTFU#VOEMFT#SPXTFS CFUB  "TTFU#VOEMF(SBQI5PPM 㸣✪ًٝ‫شذ‬ٝ‫أ‬W  ٗ٦‫ؓؿػس‬٦‫و‬ٝ‫ךأ‬何㊣ Ⰻ‫ؓؿزحٓف‬٦‫ي‬㼎韋 "OESPJEַ‫ؓؿ׵‬٦ؕ‫ أ‬ ‫ًُؗس‬ٝ‫ךز‬何㊣㔐湡 ٓٝ‫ي؎ة‬欽넝ٖ‫"ٕك‬1*‫ך‬㹋鄲 • ‫ٗٔزحم‬٦‫س‬ • "EESFTTBCMF"TTFUT • ⿫撑ؕؐٝ‫ز‬荈⹛ٗ٦‫س‬ • ‫ُٖىء‬٦‫ّء‬ٌٝ٦‫س‬ ‫ד׋׃‬ ‫׶׮א‬

43.

‫‪䎃2։‬‬ ‫ ‪獳遤‬חأ‪ٝ‬شذ‪٦ٕ 㸣✪ًٝ‬م‪٦‬غ‪ؔ٦‬ך‪ٓ؎ٝ‬ف؎ػسٕؽ‬ ‫ ‪獳遤‬חأ‪ٝ‬شذ‪"TTFU#VOEMFT#SPXTFS 㸣✪ًٝ‬‬ ‫✪‪㸣‬ך⪒‪侭‬ز‪ًُٝ‬ؗس‬ ‫*‪"1‬ي؎ة‪ְٓٝ‬׃‪倜‬‬ ‫س‪ٔٗ٦‬زحمהز‪ٗ؎ًٝ‬فرז‪넝鸞‬‬ ‫ ‪ QSFWJFX‬زؙؑآٗفٕف‪ٝ‬؟ְ׃‪倜‬‬ ‫ ‪٦ QSFWJFX‬غ‪٦‬؟ؚ‪ٝ‬؍ذأم‪ٕ欽‬س‪ٝ‬غزحإ‪،‬‬ ‫‪何㊣ QSFWJFX‬ך‪䕎䒭‬شذ‪ٝ‬؝ךٕس‪ٝ‬غزحإ‪،‬‬ ‫׶׮א‬ ‫•‬ ‫•‬ ‫•‬ ‫•‬ ‫•‬ ‫•‬ ‫•‬ ‫•‬

44.

倜‫سٕؽ‬欽"1* Unity 2017.1b (experimental) UnityEditor.Experimental.Build.AssetBundle https://github.com/Unity-Technologies/AssetBundles-BuildPipeline ‫ד׋׃‬

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; } * Input generated from asset importer meta Ⰵ⸂‫ח‬⢪ֲ‫ر‬٦‫ة‬圓鸡"TTFU#VOEMF#VJME*OQVU‫כ‬ data or any other source (external tools, etc.) ‫خ‬٦ٕ‫דزفؙٔأװ‬⡲䧭կ⡦‫ד‬⡲‫׮ג׏‬葺ְկ public AssetBundleBuildSettings settings; public Definition[] bundles; }

46.

Bundle Build Pipeline Overhaul Sneak Peak ‫؎ٓف؎ػسٕؽ‬ٝ‫ؔך‬٦‫غ‬٦‫م‬٦ٕ public struct AssetBundleBuildCommandSet { public struct Command { public AssetBundleBuildInput.Definition input; public ObjectIdentifier[] objectsToBeWritten; "TTFU#VOEMF#VJME*OQVUַ‫׵‬㹋ꥷ‫ך‬،‫غزحإ‬ٝ‫ךٕس‬ } public static AssetBundleBuildCommandSet GenerateAssetBuildCommandSet( AssetBundleBuildInput buildInput) { … } ‫חسٕؽ‬⢪欽ׁ‫و؝׷׸‬ٝ‫ָزحإس‬⡲‫׷׸׵‬կ ֿֿ‫ד‬⣛㶷ꟼ⤘鍑寸‫ؾحٔزأךزؙؑآـؔװ‬ٝ‫ָؚ‬ Command set generation gathers all 遤‫׸׻‬ծⰋ‫ָزأٔךزؙؑآـֹؔץ׷ׅ⸂⳿ךג‬⡲ dependencies, handles object stripping, and ‫׷׸׵‬ generates full list of objects to write. public AssetBundleBuildSettings settings; public Command[] commands; }

47.

Bundle Build Pipeline Overhaul Sneak Peak ‫؎ٓف؎ػسٕؽ‬ٝ‫ؔך‬٦‫غ‬٦‫م‬٦ٕ public static void SaveAssetBundleOutput(AssetBundleBuildOutput output) { … } "TTFU#VOEMF#VJME0VUQVUָ⳿⸂ׁ‫׷׸‬կֿ‫׷ײ׻ְכ׸‬植㖈‫ך‬.BOJGFTU‫ך׮׷׻➿ח‬կ Output can be serialized to JSON or any other Ꟛ涪罏‫כ‬㥨ֹ‫ז‬䕎䒭⢽ִ‫ל‬+40/‫ַה‬‫ٔءד‬،ٓ؎‫ג׃ؤ‬⢪‫׮ג׏‬葺ְկ 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)))); ‫؎ٓف؎ػسٕؽךزٕؓؿر‬ٝ

49.

倜$BDIF欽"1* Unity 2017.1b ‫ד׋׃‬

50.

0ME$BDIF"1* • 888-PBE'SPN$BDIF0S%PXOMPBE  • ‫ٗ׵ַُءحٍؗ‬٦‫ַ׷ׅس‬ծ‫ؐتל׸ֽז‬ٝٗ٦‫ُءحٍؗג׃س‬ ‫⥂ח‬㶷‫׷ׅ‬կ‫⥂חُءحٍؗ‬㶷⳿勻‫ٗל׸ֽז‬٦‫ג׃س‬،‫غزحإ‬ٝ ‫׾ٕس‬䰍‫׷ג‬կ • $BDIJOH$MFBO$BDIF  • ⥂㶷ׁ‫Ⰻ׾ُءحٍؗ׷ְג׸‬鿇灶唱‫׷ׅ‬կⰋ鿇˘Ⰻ鿇‫׌‬ • $BDIJOH*T7FSTJPO$BDIFE  • 䭷㹀‫غך‬٦‫ّآ‬ָٝ‫׾ַ׷ְג׸ׁُءحٍؗ‬然钠‫׷ׅ‬‫ֽ׌׸׉‬灶 唱‫כה׷ֹד‬鎉‫ְזג׏‬

51.

/FX$BIF"1* • ‫ה׏׮‬稢ְַⵖ䖴 • 涺ׁ‫ך׿‬銲劄‫ח‬幐‫ג׏‬鏣鎘

52.

/FX$BIF"1* • • • • • • • • • • "EE$BDIF $MFBS$BDIF $MFBS"MM$BDIFE7FSTJPOT $MFBS0UIFS$BDIFE7FSTJPOT (FU"MM$BDIF1BUIT (FU$BDIF"U (FU$BDIF#Z1BUI (FU$BDIFE7FSTJPOT *T$BDIF7FSTJPOFE .PWF$BDIF"GUFS.PWF$BDIF#FGPSF

53.

/FX$BIF"1* • $BDIFؔ‫زؙؑآـ‬ • 醱侧‫ُءحٍؗך‬㜥䨽ָ䭯‫׷ג‬ • FYQJSBUJPO%FMBZ荈⹛⵴ꤐ‫ךדת‬儗꟦ • NBYJNVN"WBJMBCMF4UPSBHF4QBDF‫ٖزأ‬٦‫חآ‬⢪ִ‫ؤ؎؟׷‬ • QBUI‫أػךפُءحٍؗ‬ • $BDIJOHDVSSFOU$BDIF'PS8SJUJOH • ‫ُءحٍؗ‬䭷㹀‫ג׃‬888-PBE'SPN$BDIF0S%PXOMPBE  • ‫⯓⮚ךُءحٍؗ‬䏝‫־♴־♳׾‬

54.

‫*‪"1‬ي؎ة‪倜ٓٝ‬‬ ‫׶׮א‬

55.
[beta]
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);
}

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();
}

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();

var carLoader = AssetBundleLoader.Factory(remoteUrl, carBundleName);
yield return carLoader.Load();
if(carLoader.assetBundle != null)
{
op = carLoader.assetBundle.LoadAssetAsync<GameObject>(carName);
yield return op;

assetBundle = handler.assetBundle;
}

var prefab = op.asset as GameObject;

}
public
public
public
public

string
string
string
string

carName;
carBundleName;
manifestName;
remoteUrl;

IEnumerator Start ()
{
var manifestLoader = AssetBundleLoader.Factory(remoteUrl,
bundleManifestName);

if(prefab != null)
GameObject.Instantiate(prefab, this.transform, false);
}
}
}

56.
[beta]
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);
}

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();
}

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();

var carLoader = AssetBundleLoader.Factory(remoteUrl, carBundleName);
yield return carLoader.Load();
if(carLoader.assetBundle != null)
{
op = carLoader.assetBundle.LoadAssetAsync<GameObject>(carName);
yield return op;

assetBundle = handler.assetBundle;
}

var prefab = op.asset as GameObject;

}
public
public
public
public

string
string
string
string

carName;
carBundleName;
manifestName;
remoteUrl;

IEnumerator Start ()
{
var manifestLoader = AssetBundleLoader.Factory(remoteUrl,
bundleManifestName);

if(prefab != null)
GameObject.Instantiate(prefab, this.transform, false);
}
}
}

57.
[beta]
倜ٓٝ‫"ي؎ة‬1*‫ך‬湡垥ֿ‫ءך‬ٝ‫׾ׁٕف‬笝䭯‫׷ׅ‬

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.

"EESFTTBCMF"TTFU

59.

‫‪ٗ٦‬ؿؙ‪ٙ٦‬זٕف‪ٝ‬ءְ׃‪倜‬‬ ‫‪٦‬وג׃ה‪BEESFTTBCMF‬׾زحإ‪ְ،‬׋׃س‪ٗ٦‬ג׃‪鸐‬׾أػ‬ ‫س‪ٗ٦‬ג׏‪⢪‬׾أٖس‪ծ،‬כزحإ‪ְ،‬׋׃س‪ٗ٦‬׵ַأٖس‪،‬‬ ‫׷ׅ‪鏣㹀‬׾‪ַ$%/‬׷ׅ⥋‪ꂁ‬׾ة‪٦‬ر׵ַֿו‬ ‫سٕؽ׾ي‪٦‬؜‬ ‫‪ծ‬ל׸ָ֮‪䗳銲‬׷ׅفح‪،‬ח‪$%/‬׾ٕس‪ٝ‬غزحإ‪،‬‬ ‫س‪ٗ٦‬فح‪،‬ח‪$%/‬‬ ‫‪⢪ֲ㜥さ‬׾ٕس‪ٝ‬غزحإ‪ָծ،‬س‪٦‬؝ׄ‪ず‬׷״ח*‪ずׄ"1‬דת➙ •‬ ‫ֻ⹛חֲ״ׄ‪ず‬׮‪ְ㜥さ‬ז׻‪⢪‬׮‬ ‫•‬ ‫•‬ ‫•‬ ‫•‬ ‫•‬ ‫׶׮א‬

60.

‫‪椚䙀‬הٕ‪٦‬؞‬ ‫׷׸ׁؚ‪ٝ‬ؗحػחٕس‪ٝ‬غزحإ‪،‬כخ‪ٝ‬ذ‪ٝ‬؝ךגץׅ •‬ ‫‪‬أػس‪ٗ٦‬ך♧⽃‪‬‬ ‫׷׸׻‪遤‬ח‪鷲麓涸‬כس‪ٗ٦‬ך׵ַٕس‪ٝ‬غزحإ‪• ،‬‬ ‫‪ְ‬ז׃‪䠐陎‬׾ٕس‪ٝ‬غزحإ‪،‬כ‪Ꟛ涪罏‬‬ ‫׸׻׵‪鎘‬חֹ‪Ⰻ鿇葺‬׮גֻז׃׮חזָ‪Ꟛ涪罏‬כأإٗفسٕؽך‪• 鸐䌢‬‬ ‫׷‬ ‫׷ֹדؤ؎وةأؕ׾גⰋכ‪㜥さծꟚ涪罏‬ז‪ٗ٦ָٕ䗳銲‬ز‪ٝ‬؝ •‬ ‫‪麣‬ז‪ָ剑黝‬׉ֿ‪ְ麣‬ז‪㼰‬ך‪䫺䫑‬׮‪• 剑‬‬ ‫׶׮א‬

61.

‫أٖس‪،‬ךزحإ‪،‬‬ ‫׷‪鏣㹀⳿勻‬ד‪鿪さ‬ך‪Ꟛ涪罏‬׾أٖس‪،‬ך‪• ⟣䠐‬‬ ‫‪竰䪫‬׾أػٕ؎‪؋‬ؿך♴⟃‪"TTFUT‬כ‪ְ㜥さ‬ז׃‪• 鏣㹀‬‬ ‫׶׮א‬

62.

‫أ‪ٝ‬؛‪٦‬ءךس‪ٗ٦‬‬ ‫ך׫‪幥‬س‪ٗ٦‬ג׃ח‪٦‬ؗ׾أٖس‪،‬ךزحإ‪✓ 6OJUZָ،‬‬ ‫ׅ‪䱱‬׾أ‪ٝ‬ةأ‪؎ٝ‬‬ ‫ַ׷ׅ‪ֲ鍑寸‬ו׾أٖس‪ծ،‬ל׸ֽזָأ‪ٝ‬ةأ‪؎ٝ‬ך׫‪幥‬س‪✓ ٗ٦‬‬ ‫׷ׇ׻‪㉏ְさ‬חؙحغٕ‪٦‬؝‬ ‫‪ַ瘝‬ךז‪ַծ$%/‬ךזٕؕ‪㜥䨽 ٗ٦‬س‪ٗ٦‬ך‪ָ㹋ꥷ‬ؙحغٕ‪٦‬؝ ✓‬ ‫ׅ‪鵤‬ח‪6OJUZ‬׾‬ ‫‪竲遤‬׾س‪ٗ٦‬ג׏‪䖞‬ח‪㜥䨽‬ך‪㹋ꥷ‬׋׏׵׮ָ‪✓ 6OJUZ‬‬ ‫׶׮א‬

63.

‫ׅדך׮ך⚥‪Ꟛ涪‬כ‪歗꬗‬‬

64.

‫زحإ‪،‬‬ ‫ؚ‪ٝ‬؍ر‪ٔٗ٦‬زحم‬ ‫׶׮א‬ ‫ד׋׃‬

66.

★ #VJME3VO‫؝כ‬ٝ‫ذ‬ٝ‫׾خ‬ろ‫سٕؽ׆׭‬ ★ 6OJUZ&EJUPSָؔٝ‫ور‬ٝ‫؝דس‬ٝ‫ذ‬ٝ‫׾خ‬䲿⣘

67.

‫׷ׅ‪㢌刿‬׾آ‪؎ً٦‬س‪ٓؐٝ‬ؙؚحغד‪٦‬ة؍رؒ‬ ‫˘׶‪䭷⟀ָ饥‬ךز‪٦‬ه‪ⱄ؎ٝ‬׵ַ‪‬ة؍رؒ‪ծ‬ה‬

68.

‫‪ٗ؎‬فرח‪澓儗‬חأ؎غرג׃׉‬ ‫‪䩛꟦ָ♶銲‬ךוזس‪ٗ٦‬فح‪ⱄ،‬װسٕؽⱄ‬

69.

‫׾ؙحغس‪٦‬؍ؿך׿ׁ‪僽ꬊ涺‬‬ ‫‪‬יג׃‪㔐瘶‬מ׈׮ز‪٦‬؛‪،ٝ‬‬