Unity Asset Bundles is a way to remotely update content in Unity Projects.
Courses
https://learn.unity.com/tutorial/introduction-to-asset-bundles
https://thegamedev.guru/unity-addressables-course/#tve-jump-1716dc061ee
https://learn.unity.com/tutorial/introduction-to-asset-bundles
Workflows
Instead of compiling the entire unity project (all the scenes), create a boot scene, and include only the boot scene in the build (Project settings), all other scenes should be build as Unity Asset bundles.
Unite 11: Scalable Game Development at Schell Games (PPT)
Unity tends to crash building a large project. That’s why they split the game into several projects: entry point project, assets projects, code project.
Entry point project is simple, contains minimum stuff to show loading screen or error screen. Loads asset bundles from asset projects and DLLs from code projects.
Content projects got their copy of DLLs, they are used to export assets to bundles and there are external tools to rebuild assets.
There’s no single source file in Unity projects.
That allows to build custom framework, use namespaces, custom compiler preprocessor and obfuscator (if needed).
But there are problems with this approach like some deeply derived from MonoBehavior classes not showing in Unity3D IDE, harder to debug, etc.
#if preprocessor instructions are used to exclude platform specific code.
Custom GUI with relative sizing and positioning of controls. Saved and loaded using ScriptableObjects.
A lot of external data handled by ScriptableObjects which are serializable, editable like Behaviors and not tied to a GameObject.
Unite 11: Postmortem – Smuggle Truck
https://www.youtube.com/watch?v=i9z_-d3C2R4
ONE project to build for all platforms. I think the project is not large, so they don’t see Unity crash much.
There’s a Level Editor which was used by players to create levels which actually shipped with the release.
Asset Settings tool to configure assets importing parameters for every platform. For example, background textures could be half-size in iPhone builds to increase performance.
Platform Specific properties can be configured with special 1. Behaviors attached to objects. For example, you could specify object’s size depending on whether the project is compiled for iOS or PC.
Custom build process allows them to use the data from 3 and 4 to set needed properties and delete unused assets before the actual build. This ensures that assets from PC build will not go to iOS build increasing its size.
At the end of the presentation they advised to have 2 copies of the project for different build targets if you have a lot of assets. Because converting from PC formats to iOS formats takes a lot of time.
https://smuggletruck.com/multiplatform/
Unite 11: Jagged Alliance Online Engineering for Large Web Player Game
http://www.youtube.com/watch?v=ndt1crp9i7M
Large games have different problems: automatic builds, light map baking which takes 4 days to complete.
Big monolithic project fails to build. (heh, been there done that)
The project is split in SEVERAL small projects: code libraries, asset project(s). This approach allows to share code between client and server. Unity3D .NET project uses 3.5 and can be referenced from 4.0 server code. Asset projects are compiled into assets bundles to be use with code.
Programmers don’t spend an hour a day waiting for assets to be imported.
Code projects are separate Visual Studio solutions kept outside of Unity3D Assets folder. It allows using namespaces (not for MonoBehaviors though). Also they use Unit Tests with modified SharpUnit framework. There are problems with built-in Unity3D classes.
Shared code between code projects and assets projects are separated in yet another project which is referenced by them as DLL libraries.
Separate VS projects are configured to build DLLs into Temp folder not to be loaded by Unity3D and causing names conflict with existing source files.
There’s an advanced automatic build system which executes light map baking and asset bundles exporting in parallel reducing average build time.
Unite 11: Creating a Browser-ready FPS MMO in Unity Slides
http://www.youtube.com/watch?v=YOY0YD75z3Q
http://www.slideshare.net/amiltondiesel/creating-a-browser-ready-fps-mmo-in-unity-pptmewfinal
Yet again, nobody uses built-in Unity GUI system.
The game looks really cool q:
There’s a custom interface to build asset bundles.
They use ScriptableObjects which are saved to XML and later loaded from server.
Tools for artists is a key to success.
Unite 11: Intro to Editor Scripting: https://www.youtube.com/watch?v=6dnQX0ChOsA
Unite 12: Advanced Editor Scripting: http://www.youtube.com/watch?v=itkm-emb5tg
Unite 13: Advanced Editor Scripting: http://www.youtube.com/watch?v=t-wShOv8c1E
Unite 11: SHADOWGUN: Rendering Techniques and Optimization Challenges
http://blogs.unity3d.com/wp-content/uploads/2011/09/Shadowgun_Unite2011.pdf
Now I have time to think what approach to use: single configurable project, many projects with source inside Unity3D Assets folder or many projects with DLLs in the final Unity3D project. At least this time I got the details.
If you want to improve your team workflow with Unity3D you must spend a day watching these videos one by one. There is a lot of interesting details and what to think about. There’s no silver bullet but there is real world experience which speakers gladly share with you.
Install this package:
https://github.com/Unity-Technologies/AssetBundles-Browser
Place this script in scene:
https://www.dropbox.com/home/xgamedev/development/UnityScripts/AssetBundles?preview=LoadAndCache.cs
Create AssetBundles
Upload to AWS S3 Bucket.
Make sure to make it Public
Copy link
example:
Asset Graph
https://bitbucket.org/Unity-Technologies/assetbundlegraphtool
AssetBundles cannot contain scripts!
AssetBundles are downloaded and cached in their entirety.
AssetBundles do not need to be loaded in their entirety.
Assets in AssetBundles can have dependencies on other assets.
Assets in AssetBundles can share dependencies with other assets.
Each AssetBundle has some technical overhead, both in the size of the file and the need to manage that file.
AssetBundles should be built for each target platform.
AssetBundle names are strictly lower case
AssetBundle flow
Organizing & Setting-up AssetBundles in the editor.
Building AssetBundles.
Uploading AssetBundles to external storage.
Downloading AssetBundles at run-time.
Loading objects from AssetBundles.
To organize and setup AssetBundles in the editor, the Assets themselves need to be assigned to an AssetBundle
After building, all the assets will got to folder: AssetBundles
AssetBundle Variants
To create different variants of the same AssetBundle they should have the same names, and same folder structures.
Disable “strip code” in the build settings.
DONT use the AssetBundle Manager on the Asset Store:
https://www.assetstore.unity3d.com/#!/content/45836
Rather use the BitBucket version:
https://bitbucket.org/Unity-Technologies/assetbundledemo
Ignore above…use this:
https://unity3d.college/2017/06/04/use-assetbundles-assetbundlemanager-update-unity3d-games/
AssetBundle Variants does not work with Simulation Mode.
https://unity3d.com/learn/tutorials/topics/best-practices/assetbundle-fundamentals
API
Initialize() Initializes the AssetBundle manifest object.
LoadAssetAsync() Loads a given asset from a given AssetBundle and handles all the dependencies.
LoadLevelAsync() Loads a given scene from a given AssetBundle and handles all the dependencies.
LoadDependencies() Loads all the dependent AssetBundles for a given AssetBundle.
BaseDownloadingURL Sets the base downloading url which is used for automatic downloading dependencies.
SimulateAssetBundleInEditor Sets Simulation Mode in the Editor.
Variants Sets the active variant.
RemapVariantName() Resolves the correct AssetBundle according to the active variant.
Asset Bundle Manual
https://docs.unity3d.com/Manual/AssetBundles-Workflow.html
NoMeLoMe Setup:
Different Apps:
NoMeLoMe Main App
Check asset bundle on the server (XML or JSON)
Need to download the assets on start
NoMeLoMe BOOK_CODE
WebGL
Caching
Caching.CleanCache() - Delete all AssetBundles that have been cached by the current app
Caching.expirationDelay
Use Caching.expirationDelay to set the number of seconds that an AssetBundle may remain unused in the cache before it is automatically deleted. When a bundle is downloaded, the timestamp is stored for that given bundle.
To set the expirationDelay property, there needs to be an entry for your application in the Cache folder. That setting is stored in a file in your applications’s root Cache folder. If the folder for your application does not exist, the file cannot be written. For that entry to exist you need to first request a bundle. So in order to set the expirationDelay, first request at least one bundle which will create the folder for your app’s bundles. You could use any bundle just to make sure the folder exists before you call that property.
Caching References
https://docs.unity3d.com/ScriptReference/Caching.html
https://support.unity3d.com/hc/en-us/articles/207710103-How-do-I-delete-AssetBundles-from-the-cache-
https://unity3d.com/learn/tutorials/topics/best-practices/assetbundle-usage-patterns
References
https://unity3d.com/learn/tutorials/topics/scripting/assetbundles-and-assetbundle-manager
https://www.youtube.com/watch?v=53wdTjT4Jp8
https://www.youtube.com/watch?v=mr3cus2C16M&t=2s
https://unity3d.com/learn/tutorials/topics/best-practices/guide-assetbundles-and-resources
https://docs.unity3d.com/Manual/AssetBundlesIntro.html
https://blogs.unity3d.com/2016/10/25/new-assetbundle-graph-tool-prototype/
https://www.youtube.com/watch?v=GEoEvDYNa1w
https://www.youtube.com/watch?v=Od9z7OSfGvY
https://www.youtube.com/watch?v=2EPQId90fk4
Really good video:
https://www.youtube.com/watch?v=cUY_6_f_50k
http://gyanendushekhar.com/2017/07/18/asset-bundle-browser-unity-2017-tutorial/
Upload to AWS
https://forum.unity.com/threads/asset-bundle-support.268916/
Load Scene from AssetBundle:
https://docs.unity3d.com/ScriptReference/SceneManagement.SceneManager.LoadScene.html
Unit Austin 2017
https://www.youtube.com/watch?v=r1kslvqXAq8
Unite 2012 - Asset Bundles : Creative Uses and Best Practices
https://www.youtube.com/watch?v=Od9z7OSfGvY
So, how do teams work on a big Unity3D project?
http://va.lent.in/so-how-do-teams-work-on-a-big-unity3d-project/
Unite 11:
https://www.youtube.com/playlist?list=PLX2vGYjWbI0Q7HYmCTbZyMOTmb4R9RYrf
https://answers.unity.com/questions/186421/how-do-teams-work-on-projects.html
https://plus.google.com/+NabeelSaleem/posts/FQ8EuqPQUjx
http://unity3diy.blogspot.com/2014/09/14-best-free-collaboration-tools-for.html
http://www.kinematicsoup.com/scene-fusion/?utm_source=UnityAnswers
https://blogs.unity3d.com/2014/01/07/unity-and-kii-cloud-team-up-for-the-love-of-the-game/
https://blogs.unity3d.com/2018/02/26/meet-the-inspiring-unity-developers-of-tomorrow/
https://docs.unity3d.com/Manual/HOWTO-UIFitContentSize.html
https://blogs.unity3d.com/2017/06/02/introducing-remote-settings-update-your-game-in-an-instant/
https://docs.unity3d.com/Manual/UnityAnalyticsRemoteSettings.html
https://forum.unity.com/threads/remote-settings-takes-two-loads-to-update.504378/
https://www.gamasutra.com/blogs/DennisPiatkowski/20180202/313434/Unity3d_Asset_Bundle_Series.php
http://berserk-games.com/knowledgebase/assetbundles/
https://www.gamasutra.com/blogs/DennisPiatkowski/20180202/313434/Unity3d_Asset_Bundle_Series.php
http://berserk-games.com/knowledgebase/assetbundles/
https://www.gamasutra.com/blogs/DennisPiatkowski/20180202/313434/Unity3d_Asset_Bundle_Series.php
https://learn.unity.com/tutorial/assets-resources-and-assetbundles
http://staraban.com/en/unity-dlc-system-implementation-problems-and-features-tutorial/
Workflow
Install this package:
https://github.com/Unity-Technologies/AssetBundles-Browser
Place this script in scene:
https://www.dropbox.com/home/xgamedev/development/UnityScripts/AssetBundles?preview=LoadAndCache.cs
Create AssetBundles
Upload to AWS S3 Bucket.
Make sure to make it Public
Copy link
example:
Research
AssetBundles cannot contain scripts!
AssetBundles are downloaded and cached in their entirety.
AssetBundles do not need to be loaded in their entirety.
Assets in AssetBundles can have dependencies on other assets.
Assets in AssetBundles can share dependencies with other assets.
Each AssetBundle has some technical overhead, both in the size of the file and the need to manage that file.
AssetBundles should be built for each target platform.
AssetBundle names are strictly lower case
AssetBundle flow
Organizing & Setting-up AssetBundles in the editor.
Building AssetBundles.
Uploading AssetBundles to external storage.
Downloading AssetBundles at run-time.
Loading objects from AssetBundles.
To organize and setup AssetBundles in the editor, the Assets themselves need to be assigned to an AssetBundle
After building, all the assets will got to folder: AssetBundles
AssetBundle Variants
To create different variants of the same AssetBundle they should have the same names, and same folder structures.
DONT use the AssetBundle Manager on the Asset Store:
https://www.assetstore.unity3d.com/#!/content/45836
Rather use the BitBucket version:
https://bitbucket.org/Unity-Technologies/assetbundledemo
Ignore above…use this:
https://unity3d.college/2017/06/04/use-assetbundles-assetbundlemanager-update-unity3d-games/
AssetBundle Variants does not work with Simulation Mode.
https://unity3d.com/learn/tutorials/topics/best-practices/assetbundle-fundamentals
API
Initialize() Initializes the AssetBundle manifest object.
LoadAssetAsync() Loads a given asset from a given AssetBundle and handles all the dependencies.
LoadLevelAsync() Loads a given scene from a given AssetBundle and handles all the dependencies.
LoadDependencies() Loads all the dependent AssetBundles for a given AssetBundle.
BaseDownloadingURL Sets the base downloading url which is used for automatic downloading dependencies.
SimulateAssetBundleInEditor Sets Simulation Mode in the Editor.
Variants Sets the active variant.
RemapVariantName() Resolves the correct AssetBundle according to the active variant.
Asset Bundle Manual
https://docs.unity3d.com/Manual/AssetBundles-Workflow.html
NoMeLoMe Setup:
Different Apps:
NoMeLoMe Main App
Check asset bundle on the server (XML or JSON)
Need to download the assets on start
NoMeLoMe BOOK_CODE
References
https://unity3d.com/learn/tutorials/topics/scripting/assetbundles-and-assetbundle-manager
https://www.youtube.com/watch?v=53wdTjT4Jp8
https://www.youtube.com/watch?v=mr3cus2C16M&t=2s
https://unity3d.com/learn/tutorials/topics/best-practices/guide-assetbundles-and-resources
https://docs.unity3d.com/Manual/AssetBundlesIntro.html
https://blogs.unity3d.com/2016/10/25/new-assetbundle-graph-tool-prototype/
https://www.youtube.com/watch?v=GEoEvDYNa1w
https://www.youtube.com/watch?v=Od9z7OSfGvY
https://www.youtube.com/watch?v=2EPQId90fk4
Really good video:
https://www.youtube.com/watch?v=cUY_6_f_50k
http://gyanendushekhar.com/2017/07/18/asset-bundle-browser-unity-2017-tutorial/
Upload to AWS
https://forum.unity.com/threads/asset-bundle-support.268916/
Load Scene from AssetBundle:
https://docs.unity3d.com/ScriptReference/SceneManagement.SceneManager.LoadScene.html
https://docs.unity3d.com/ScriptReference/AssetDatabase.AddObjectToAsset.html
https://forum.unity.com/threads/asset-bundle-analyzer.182413/