Import Assets Into Your Scene

The AssetlayerGameObject is a prefab that helps you load in assets into your scene directly from Asset Layer. The AssetlayerGameObject can be integrated into your scene in any way - as a standalone GameObject, nested into other GameObjects, or even nested with other AssetlayerGameObjects!

The AssetlayerGameObject prefab can be found in Assets/AssetlayerUnitySDK/Prefabs.

AssetlayerGameObject comes with a few scripts that are helpful to understand.

Asset Bundle Importer

This script is where you set the asset you want imported into your AssetlayerGameObject. You can set this manually in the editor, or through code using the SetNewAsset method. In addition to specifying an assetId, you can also specify the expressionId for the AssetBundle expression value you want loaded into the game. If no expressionId is specified, the first expression fitting the Unity expression type will be chosen. By specifying the expressionId, you can have multiple AssetBundles associated with a single asset, enabling you to represent your asset in different ways depending on the context. For more information on AssetBundles, check out Create Assets in Unity. And for more on Expressions in general, check out Expressions.

Asset Bundle Downloader

This script won't require you to do anything. It is a helper script that facilitates the downloading of the AssetBundle for the selected asset from the Asset Layer API.

Load Current Selection

If Load Current Selection is activated, then it will try and load the most recently used asset from the player prefs when the scene loads. This is a great way to provide a seamless experience for a returning user. You can also specify a default model to display in case there is no asset in the player prefs.

Selection Subscriber

This can be used in conjunction with the Inventory Manager. When selection subscriber is turned on, the AssetlayerGameObject will import whatever asset is chosen in the inventory. It automatically searches for the Asset Layer Inventory and subscribes to asset selection events. You have the option to specify which methods are called upon these events; by default, the SetNewAsset method of the Asset Bundle Importer is invoked.

Last updated