Custom AssetBundle
View the AssetBundles Tutorial Video
An AssetBundle is the most advanced, fully featured asset type for Tabletop Simulator. An asset is created in Unity, and then exported in a special format to be imported into your game.
AssetBundle Features¶
AssetBundles can do many things other custom Objects cannot.
- Customizable physics sounds
- Access to the full array of Unity materials
- Play custom sounds
- Triggerable animations and looping animations
- Particles
- Lights
- And more
Basically, if you can make the object in Unity using all of the default resources available, you can import it into your game.
Instructions¶
In order to create an AssetBundle, you will need to:
- Download/Install Unity
- Download GitHub Project file
- Open project file in Unity
- Create Asset using Unity
- Export to AssetBundle
- Import in Tabletop Simulator
Follow the instructions for each step closely.
Install Unity¶
The first thing you need is Unity. But not just any version of Unity, it needs to be Unity 2019.4.40f1.
You want the installer.
Wrong Unity Version
Using the wrong version of Unity will result in possible issues in your exported AssetBundles, if it works at all.
Run the installer and you will be asked which components to include. Be sure Windows, Linux and Mac are all checked.
Download Project¶
Download the project file from GitHub.
If needed, unzip the files, and then place them into the directory of your choice.
Open Project¶
Run Unity. A window opens, asking if you want to create a new project or open one.
Select Open and choose the folder obtained from GitHub.
Create Asset¶
Any number of methods can be used to create an Asset, so the steps you take here are based on the end-result of what you are trying to make.
Asset Examples¶
The project file contains some examples of assets as well as an example scene that matches the Museum background's lighting.
You are not required to use any of these when creating your asset.
Example Asset Creation¶
You can create any asset, but here is an example of basic asset creation.
Optional Scripts¶
There are 2 scripts included which you can add to Assets you create.
- TTSAssetBundleEffects: In Tabletop Simulator, this will add an option in the Object's context menu. There are two types:
- Trigger: Used to activate animations, sounds, lights, etc that run once and stop.
- Looping: Used to activate animations, sounds, lights, etc that continue running until another Loop is activated.
- TTSAssetBundleSounds: In Tabletop Simulator, this lets you replace the sound that this Object would make with custom sounds.
In Tabletop Simulator, Lua scripting is able to interact with these triggers. However you are not able to create/add your own Unity scripts to Objects.
Export AssetBundle¶
Once you are finished creating your asset, you must turn it into a pre-fab.
Then, while selecting the prefab you wish to export in Unity look at the Inspector tab and scroll to the bottom until you see a dropdown labeled "AssetBundle". Name it whatever you would like your final unity.3d file to be named.
Then Build the AssetBundle by right-clicking anywhere in the project view and selecting Build AssetBundles.
The resulting file that is created will be found in the Project folder under AssetBundles.
The file format for an AssetBundle is
.unity3d
Import AssetBundle¶
Open Tabletop Simulator and upload your AssetBundle to a webhost or the in-game Steam Cloud.
Importing Assets
How you choose to import files impacts if other players can see them when you're finished.
For help with importing, visit Asset Hosting.
Secondary AssetBundles¶
Secondary AssetBundles are an additional AssetBundle which are great for shared effects like sound or particle effects that you want to use on multiple objects without duplicating them in each individual asset bundle. Great for reducing memory and bandwidth usage.
In the example below, the main AssetBundle is the blue capsule and the secondary AssetBundle is the explosion and light effect. This allows you to reuse the explosion and light effect on any one of your AssestBundles for greater modularity and reduced memory and bandwidth usage.
Best Practices¶
- Avoid duplicating large assets like textures and sounds on multiple AssetBundles by using Secondary AssetBundles.
- Don’t use legacy, mobile, or custom shaders because they will most likely show up as pink on other platforms.
Texture Import Settings¶
- If your textures don’t need transparency, use RGB Compressed DXT1.
- If your textures need alphas retained, highlight just those textures and change the format to RGBA Compressed DXT5.
- NEVER use uncompressed textures.
- Make sure the texture is the size that makes sense for it, but watch out for the size of the texture as that will eat up a lot of space.
- Save 4k textures for large boards and other similar items.