Give Page Feedback

Getting Started Tutorial - Setting The Scene

Now that you've setup your first Streamable Grid Asset, you can start configuring your scene.

Section Instructions

16) Use the GameObject -> Create Other -> Deep Space Labs -> SAM -> Default SAM Setup command to add a set of default game objects and components to the scene. You can also access this command by right clicking in the Scene Hierarchy (and note, this command is a shortcut but it is not the only way to setup SAM).

17) Explore the added game objects and components (The Default Setup Sub-Section).

18) Understand the Component Manager's Purpose (The Component Manager Sub-Section).

19) Configure the SAMInitializer component and determine if you'd like to leave its Initialize On Startup option enabled, or hook one of its Initialization methods up to a button (or otherwise call it from script) (The SAM Initializer Sub-Section).

20) Determine if you'd like to start out by loading scene Asset Chunks or prefab Asset Chunks (or addressable versions of the two, however we suggest not starting out with addressables at the very beginning). By default we have configured SAM to use scene assets (which is done via the Scene Chunk Streamer), however if you wish to start out using Prefabs, add a Prefab Chunk Streamer component to the scene and drag a reference to it onto the Default Chunk Streamer field, found in the Overridable Settings main tab of the World Component. More info can be found in The Scene Chunk Streamer Sub-Section.

21) If using prefabs, and if you know you will use prefabs for all assets (i.e., you will not use scenes or addressable scenes), you can remove the Scene Chunk Streamer from the scene. Alternatively, you can leave it in the scene if you are not sure. It will have minimal impact on memory.

22) If using prefabs, make sure they are stored directly in a folder called Resources or in a sub folder (if using a sub-folder, additional setup is required, which is outlined in the dedicated Prefab Streamer Section in the Chunk Streamers Chapter). A quick-open button for this Section can be found in The Scene Chunk Streamer Sub-Section.

23) If using scenes, make sure the scenes have been added to the Build Settings Window (if the scenes have not been created yet and you are planning on using the World Designer Tool to create them, you can skip this step, as they will be automatically added to Build Settings later).

The Default Setup

Return To Section Instructions

Executing The Default SAM Setup Command GIF

The Default SAM Setup command adds the following game objects to the scene:

1) Streamable Assets Manager (semi-empty parent object used for organization)

2) SAM Initializer (contains the SAMInitializer component - currently using this is optional, but starting with v1.5.0 it will be the go to means of initializing SAM)

3) Component Manager (contains the Component Manager component)

4) World (contains the World component)

5) Active Grid (contains the Active Grid component)

6) Default Components (contains a Non Pooling Chunk Manager, a Scene Chunk Streamer, a Frame Rate Dependent Execution Controller, a Standard Hierarchy Organizer, and a Standard Hierarchy World Shifter)

7) Other Components (contains the Boundary Monitor component)

Default SAM Objects JPG

References between components are configured automatically when you use the above command. If you add more components to the scene in the future and/or remove/change some of the components (usually one of the Default Components), these connections will need to be re-established.

If any references are missing, you will see an Error Message in the Console Log when you enter Play mode.

The Component Manager

Return To Section Instructions

1) When initialized (via scripting or the SAMInitializer component), initializes everything related to the Streamable Assets Manager.

2) Handles Saving/Loading

3) Where you will assign prototypes to create Active Grids and Worlds at runtime.

If you are an existing user of SAM who recently upgraded to 1.5.0, you may notice that the Initialize On Awake option and Context Menu Commands for initialization no longer exist. This functionality has been moved to the SAMInitializer (the setting is now called Initialize On Startup).

No additional setup should be required for the Component Manager, however do note that if you enter Play Mode now errors will likely be thrown, as there is some additional setup required (keep reading!).

Read More About Component Managers

--Upgrade Note--
Even though the Component Manager class has not been renamed, the class, like all other classes, has been moved into a new Class Library (DLL file). As such, any old Component Managers you have from the Terrain Slicing & Dynamic Loading Kit will not be useable with the SAM. Please follow the Component Managers Section for details on how to uprade these old Component Managers!

Upgrading Component Managers

The SAM Initializer

Return To Section Instructions

This component attempts to streamline the initialization process. You can either use the automatic initialization functionality by enabling Initialize On Startup, or trigger initialization manually by calling the SAMInitializer's InitializeSAM_Immediate or InitializeSAM_Gradual method.

We normally recommend calling these methods from a Button's OnClick event, however you have total freedom in how the methods are called (from another script is also an option).

Even though you could technically avoid using the SAMInitializer altogether by manually triggering initilization via scripting (by calling certain methods of the Component Manager), the great thing about the Initializer is that you can easily configure different game objects to be activated and/or deactivated before and/or after the initialization process completes, or hookup events to run before/after initialization.

In addition, you can hook up text and/or a slider to the Initializer so that the Initialization Progress can be displayed to your user, as well as modify the Application.backgroundLoadingPriority setting to make initialization run faster.

You can read more about the SAMInitializer, as well as about how to create and hook up text and sliders to it within the Initialization Section of the Component Managers Chapter.

Read More

--Sample Scene Directions--
Following the format of the other Sample Scenes, there are a few modifications to the SAMInitializer that need to be made at this time:

1) Set the Destroy Before Initialization array size to 1 and then drag the PrePlayModeText GameObject (found under the Canvas GameObject) to the Element 0 field.

2) Set the Activate After Initialization array size to 4 and then drag the following Game Objects to the specified fields. Player to Element 0, Controls to Element 1, Show_or_Hide_Instructions_Toggle to Element 2, and Instructions Panel to Element 3 (these last three GameObjects can be found under the Canvas GameObject).

The World

Return To Section Instructions

The World is probably the most important Component in the Streamable Assets Manager. It has countless settings, and as such, we will be covering its initial setup in the next Section.

If you want more detailed information than this next Section provides, feel free to take a look at the dedicated World Chapter.

Interested In The World?

--Upgrade Note--
Even though the World class has not been renamed, the class, like all other classes, has been moved into a new Class Library (DLL file). As such, any old Worlds you have from the Terrain Slicing & Dynamic Loading Kit will not be useable with the SAM. Please follow the Worlds Section for details on how to uprade these old Worlds!

Upgrading Worlds

The Active Grid

Return To Section Instructions

The Active Grid is also a complex and important Component in the Streamable Assets Manager. We will cover initial setup for it in the Section following the World Setup Section.

If you want more detailed information than that Section provides, feel free to take a look at the dedicated Active Grid Chapter.

Interested In The Active Grid?

--Upgrade Note--
Even though the Active Grid class has not been renamed, the class, like all other classes, has been moved into a new Class Library (DLL file). As such, any old Active Grids you have from the Terrain Slicing & Dynamic Loading Kit will not be useable with the SAM. Please follow the Active Grids Section for details on how to uprade these old Active Grids!

Upgrading Active Grids

The Non Pooling Chunk Manager

Return To Section Instructions

A simple Chunk Manager for managing the life cycle of Asset Chunks.

A Simple Pooling Chunk Manager, Distance Based Chunk Manager, or Custom Chunk Manager can be used in its place, however we do not recommend making that change until you have investigated Chunk Manager's in detail.

If for some reason you do decide to change the starting Chunk Manager, you will need to assign the new Chunk Manager to the World, specifically to the Default Chunk Manager field within the Overridable Settings Window.

A single type of Chunk Manager can be used by all LOD Groups on your World, or you can assign different Chunk Managers to different LOD Groups or World Groupings as a whole. This allows you to change the pooling behavior and Asset Management logic for each type of Asset in your game, if you wish.

Want To Investigate Chunk Manager In Detail?

--Upgrade Note--
Chunk Managers were formerly called Primary Cell Object Sub Controllers, and this Component was formerly called the Non Pooling Primary Cell Object Sub Controller. Any old Non Pooling Primary Cell Object Sub Controllers you have from the Terrain Slicing & Dynamic Loading Kit will not be useable with the SAM. Please follow the Non Pooling Primary Cell Object Sub Controllers Section for details on how to uprade these old Non Pooling Primary Cell Object Sub Controllers!

Upgrading Non Pooling Primary Cell Object Sub Controllers

The Scene Chunk Streamer

Return To Section Instructions

Enables streaming of Scene Assets that have been added to Unity's Build Settings Window.

There are several other Chunk Streamers available for use, and if you're not using non addressable Scene Assets, you will need to switch to one of them. You can read more about these different Chunk Streamers in the dedicated Chunk Streamers chapter.

If you are using Prefab Assets instead of Scenes, you can exchange the Scene Chunk Streamer for a Prefab Chunk Streamer. This component can be found where all Chunk Streamers are found, within the Component Menu.

Simply remove the Scene Chunk Streamer, then press Add Component -> Deep Space Labs -> -> SAM -> Chunk Streamers -> Prefab Chunk Streamer. Note, some additional setup on the component and on the Streamable Grid will likely be needed.

In addition, the prefabs need to be stored either directly in a folder called Resources (less setup), or in a sub-folder of the Resources folder (slightly more setup). Please take a look at the dedicated Prefab Streamer Section for more details, especially if you decide to store your prefabs in a sub-folder.

Prefab Chunk Streamers

If for some reason you do decide to change the starting Chunk Streamer, you will need to assign the new Chunk Streamer to the World, specifically to the Default Chunk Streamer field within the Overridable Settings Window/Tab.

A single type of Chunk Streamer can be used by all LOD Groups on your World, or you can assign different Chunk Streamers to different LOD Groups or World Groupings as a whole. This allows you to support multiple types of Asset Chunks on the same game world!

Want To Investigate Chunk Streamers In Detail?

--Upgrade Note--
Chunk Streamers were formerly called Cell Object Loaders, and this Component was formerly called the Scene Loader. Any old Scene Loaders you have from the Terrain Slicing & Dynamic Loading Kit will not be useable with the SAM. Please follow the Upgrading Scene Loaders Section for details on how to upgrade these old Scene Loaders!

Upgrading Scene Loaders

Upgrading Prefab Loaders

--Sample Scene Directions--
While the other sample scenes in the Samples package use prefabs and the Prefab Chunk Streamer (solely so that the demo scenes work out of the box without additional setup), the Scene Chunk Streamer is usually a better option and what we suggest using, so there is no need to change it out for a Prefab Chunk Streamer.

The Frame Rate Dependent Execution Controller

Return To Section Instructions

This component is used to limit the execution of the World. There are two other default Execution Controller's available which can be found in the Execution Controller Sub Menu of the Add Component Menu. You can also create a custom Execution Controller if you wish.

The Frame Rate Dependent Execution Controller attempts to limit the World from beginning or continuing execution if the current frame has been executing for too long. While it cannot directly stop the frame from surpassing the threshold set, as other scripts/stuff may push it past the threshold, limiting the World from taking it past the threshold is better than nothing.

A single Component of the default Execution Controllers can only be used with a single World. If you add more Worlds, you will need to add more components!

Want To Investigate Execution Controllers In Detail?

The Standard Hierarchy Organizer

Return To Section Instructions

This component is used to organize how the Asset Chunks added to the scene by SAM are organized in the Scene Hierarchy.

Since using SAM can result in a lot of Asset Chunks/game objects, the primary benefit of using a Hierarchy Organizer is in keeping the scene from becoming overwhelmed with root objects that make identifying specific game objects difficult.

However, the organizer also allows you to organize the Asset Chunks in a way that may be easier to search through and manipulate at runtime, which is useful both inside and outside of the editor.

The Standard Hierarchy Organizer gives you a lot of flexibility in how the Asset Chunks are organized, and is designed to be used in conjunction with the Standard Hierarchy World Shifter. With that said, you are always free to create a custom Hierarchy Organizer if the Standard one does not suit your needs.

Want To Investigate Hierarchy Organizers In Detail?

The Standard Hierarchy World Shifter

Return To Section Instructions

This component is used to shift the World's Asset Chunks during Origin Cell Changes, however it is only used on Floating Origin based Worlds (not on Fixed Worlds).

The shifter is designed to work in conjunction with a Standard Hierarchy Organizer. If you are not using the Standard Hierarchy Organizer, you should not use this World Shifter!

This Shifter should be suitable for most users, however if you need more fine-tuned control over the shifting process (such as more precise timing of when the Player is moved), you should consider creating a custom World Shifter.

Want To Investigate World Shifters In Detail?

The Boundary Monitor

Return To Section Instructions

A simple component that works in conjunction with the Active Grid to track the Player and determine if that Player has crossed specific boundaries that trigger world updates and other things.

A single Boundary Monitor instance can be used with multiple Active Grids, so there should be no need to add more of this component to the scene. If in the future you decide not to use Active Grids, you can safely remove this component.

The Boundary Monitor has been automatically assigned to the Active Grid in the scene, but if you add more Active Grids to the scene in the future, you will need to manually assign it to those components! The field to assign it to is called Boundary Monitor and can be found in the Active Grid's General Settings Window.

Learn More About Boundary Monitors

--Upgrade Note--
Even though the Boundary Monitor class has not been renamed, the class, like all other classes, has been moved into a new Class Library (DLL file). As such, any old Boundary Monitors you have from the Terrain Slicing & Dynamic Loading Kit will not be useable with the SAM. Please follow the Boundary Monitors Section for details on how to uprade these old Boundary Monitors!

Upgrading Boundary Monitors