Links

Create Assets in Unity

This guide will walk you through how to create new Asset Layer collections and update existing collections directly from the Unity Editor.

How Asset Layer Uses AssetBundles

In Unity, an AssetBundle is a collection of assets from your project that can be loaded at runtime. Almost any type of asset used in a Unity project can be included in an AssetBundle. This includes:
  1. 1.
    3D Models: All types of 3D models, including their meshes and textures.
  2. 2.
    Textures and Materials: Images used for texturing objects, along with materials that define the surface appearance of 3D models.
  3. 3.
    Animations: Character animations or any other type of animations.
  4. 4.
    Audio Files: Sound effects, music, and any other audio assets.
  5. 5.
    2D Sprites: Including characters, backgrounds, UI elements, and any other 2D artwork.
  6. 6.
    Scripts: While scripts themselves aren't directly included, references to scripts in your build can be included. The Scripts itself are uploaded seperately to Asset Layer, allowing apps that integrate your assets to download them into their build. This ensures that the references in your asset bundle will function correctly.
  7. 7.
    Prefabs: Pre-constructed game objects with their components and properties set up.
  8. 8.
    Scenes: Entire Unity scenes can be packed into an AssetBundle.
  9. 9.
    UI Elements: UI assets like sprites, fonts, and other elements used in canvas.
  10. 10.
    Particle Effects: Custom particle systems and their associated assets.
  11. 11.
    Shader and Text Assets: Custom shaders and text files, including JSON or XML data.
Asset Layer uses AssetBundles because they are particularly useful for managing and optimizing resource loading into a game, especially for large projects or games requiring dynamic content loading. They allow you to reduce the initial download size of your game by loading assets on demand rather than bundling everything with the main game package.
When creating Asset Layer assets in Unity, you are utilizing the AssetBundle expression. This allows you to import your Asset Layer assets directly into your scenes at runtime.

Creating a New Collection Through Unity

To create a new Asset Layer collection through Unity, right click the file you want to turn into a collection. This can be a prefab, a model, a scene, or anything else. The Asset Layer Unity integration expects currently one file per bundle. However, multiple items can be grouped within a single prefab, which can then be bundled.
Once you right click the file, you will see an AssetLayer menu. Hover over this and then select Create New Collection.
Create New Collection
Selecting Create New Collection will bring up a window like what is pictured below. This will allow you to select which slot your collection belongs to as well as the Expression it should be created for. For more information about slots, check out Slots and Manage Slots and Expressions
When creating a collection, you can specify a collection name and maximum supply. To set a maximum supply, uncheck the 'No Max' option and input the desired limit for asset creation within this collection. Finally, you can provide an image to be the collection image and menu view expression for your new collection. If you don't select a file, an image will be automatically generated for you. The 'Mint immediately' feature allows you to determine the number of assets to be minted directly to your account upon the successful creation of the collection..
You will be able to edit all of this in the Asset Layer app. To learn how, check out Manage Collections
Once you click "Submit", your file will be turned into an AssetBundle and uploaded as an expression value for your Asset Layer collection. By default, your file will be exported for iOS, Android, Mac, Windows, and WebGL. Additionally, a Unity Package is created and uploaded.
Please Note: Exporting AssetBundles can take some time. Large files can also pose challenges for the Asset Layer API. Our max expression value size is 100MB. There are typically compression options which you can implement before creating your AssetBundle to reduce the export size.
After creating your new collection, it will be visible in your project's Assets folder under Assets/AssetLayerUnitySDK/AssetBundles, with the UnityPackage located in Assets/AssetLayerUnitySDK/UnityPackages. Assets are organized into subfolders based on the slot for which they were created.
When extracting the created Unity Packages in other projects (see Sync Your Assets), maintaining a cleaner folder structure is beneficial. To achieve this, place all assets associated with the prefab you are converting into an Asset Layer Asset within a single folder. This approach ensures the folder structure is neatly recreated in the project where the packages are extracted.

Update an Existing Collection

To update the AssetBundle associated with an existing collection, simply right click on the file you want to export as the new AssetBundle for your collection.
Once you right click the file, you will see an AssetLayer menu. Hover over the Update tab and then select Upload Expression Assets.
This will open a menu where you input your collection id and the expression id that you want your assets to be uploaded to. Check out Manage Collections for more info on getting your collection id.
And Manage Slots for more info on getting your expression id.