Working with Spawnable Assets

Overview

During the assembly phase, it is common to make frequent changes to spawnable assets. It is cumbersome to have to bundle and deploy them through Storyflow to test the changes. At the same time, you want to work with a single Storyflow Script, so you don’t want to switch between Spawn Asset and Scene Object in the Script.

Option 1: Skip Asset Load

How do I do this?

If you are targeting assets as Scene Objects in a spawned prefab, you can tell the SDK to skip the load step for Spawn Asset by toggling the setting on the “World” node of the VR App prefab:

image-20240315-164637.png
  • Never - always load spawned assets

  • Editor Only - only skip the load when running in editor

  • Always - always skip loading assets

How is this helpful?

By telling the system to Skip Asset load, you can configure and edit objects directly in the scene without having to make changes to the Storyflow Script. The SDK will complete processing the Spawn Asset Resource as though it loaded the assets.

Using additive scenes

When using Skip Asset Load, it is useful to use an additive scene (https://docs.unity3d.com/2020.1/Documentation/Manual/MultiSceneEditing.html ) to configure the assets. This avoids accidentally including the configured assets in a build that also loads the assets, resulting in duplicated assets in the scenario.

A common setup might look like this:

image-20240315-165826.png
  • Workshop Init - Platform-specific init scene

  • Workshop Scene - Primary environment

  • Workshop Props - Props prefab that is spawned from an Asset Bundle

Troubleshooting

  • It is a common mistake to reset the “Skip Asset Load” setting after testing. If you notice that your assets aren’t spawning in editor or your build this is the first place you should look.

  • It is important to make sure any changes to asset prefabs are committed back to the prefab before bundling.

Option 2: Use “Spawnable Prefabs”

Skip Asset Load is useful in the early stages of a project when you are making regular changes to objects and working on their position in the environment. However it can be error-prone as you have to remember to toggle the “Skip Asset Load” setting and make sure that the prefabs have been fully committed before bundling.

Spawnable Prefabs gives you a simple way to spawn local versions of your assets without having to bundle. This more closely mimics the final Asset Bundle flow, while still giving you the workflow benefits of making regular changes locally.

Spawnable Prefabs are configured using the SpawnablePrefabs component. Note that this component is a singleton, so you can only have one in your scene(s).

In this configuration, “Region” and “Safety Hat” will be spawned from the linked Prefabs instead of from an Asset Bundle, even if there is an Asset Bundle attached to the Asset in Storyflow.