Give Page Feedback

World Designer Tool - Assignment Operations

The Assignment Operation can only be used manually via the A* button found on each LOD in the Cell Color Key. This operation takes a collection of Game Objects in open scenes and calculates which Streamable Grid Cell (for the Grouping being edited) they fall within.

If Try Use Mesh Bounds is enabled (under Advanced Operation Settings/General Settings), the center of each game object's mesh bounds is used to calculate the cell. If that option is disabled or the game object does not have a mesh to use, the position of the Game Object is used instead. It then assigns those objects as children of the Asset Chunks associated with whichever LOD the Assignment Operation was initiated for.

This is one of the most powerful Operations for taking existing over-bloated scenes and converting them into more manageable Streamable Assets. There are six techniques available for choosing which Game Objects are selected for the Assignment Operation (which you can choose via the What To Assign option, found in the Advanced Operation Settings window and Assignment Settings tab). These include:

Selected Objects

This is the simplest technique. You manually select game objects from loaded Scenes and those Game Objects (and only those Game Objects) are assigned to the Grouping's LOD Asset Chunks.

Selecting many game objects will slow the Editor to a crawl, however, so if you want to assign 1000's of game objects at once, one of the other techniques will probably be better.

Children Of Parent

This is another simple technique; you assign a Transform to the Assignment Parent field, and all first level children of that parent are assigned to the Grouping's LOD Asset Chunks (the Parent itself is not assigned).

This is very useful if you have a lot of differently named children under a single parent and selecting them manually would slog down the Editor. The limitation, of course, is that only one parent can be assigned for each execution of the Assignment Operation, so this technique is not as great if you have many children you want to assign that use different parents.

Hierarchy Searches

The remaining What To Assign options all utilize a hierarchy based searching technique, so it's important to understand how that works.

For these options, you always have the option to provide an Assignment Parent. When an Assignment Parent is provided, the World Designer conducts a top down search of the hierarchy of each first level child of the parent. For each child, it searches its entire hierarchy until it finds a Game Object that matches a rule (according to the option chosen), at which point it adds that object to an internal collection and stops its search of that child's hierarchy. This ensures that descendants of the assigned object cannot also be assigned.

When no Assignment Parent is provided, the top down search begins with all root level game objects in all loaded scenes and searches each of their hierarchies. Since this could potentially be a TON of objects, care should be taken when using this option. We recommend starting with an Assignment Parent and proceeding with no Assignment Parent only if the operation with the Assignment Parent did not encounter any problems.

Regular Expression Matches (Hierarchy Search)

This is a hierarchy search where each Game Object's name is compared against a regular expression. If Regex.IsMatch returns true, the game object is selected for assignment (and descendants of it are automatically excluded from being assigned as well).

Some examples of valid Regex Patterns are ^'str' and 'str'$, where the 'str' is replaced by your string. For example, ^Bush will match objects whose names begin with the word Bush, while Bush$ will match objects whose names end with the word Bush. In these example regex patterns, the strings are case sensitive!

Game Objects With Tag (Hierarchy Search)

This is a hierarchy search where each Game Object's tag is compared against a provided string (Tag setting). If the tag of the game object is equal to the provided string, the game object is selected for assignment (and descendants of it are automatically excluded from being assigned as well).

Game Objects On Layer (Hierarchy Search)

This is a hierarchy search where each Game Object's Layer (as set via the Layer dropdown next to the Tag dropdown in the game object's inspector) is compared against a provided string (Layer setting). If the layer of the game object is equal to the provided string, the game object is selected for assignment (and descendants of it are automatically excluded from being assigned as well).

Custom Assignment Selector (Hierarchy Search)

With this method, you can create a custom Scriptable Object class that derives from AssignmentSelector and override its IsMatch and (optionally) OnAssignmentStarting methods. The IsMatch method is used to decide whether each game object in the hierarchy search is a match, which simply means it will be selected for the current Assignment Operation.

This is a very useful tool in your tool-belt, even if you wish to use one of the same techniques as the built-in Hierarchy Search based options, because you can configure the Assignment Selector to work with multiple different Worlds, World Groupings, and/or LOD Groups (meaning there are less settings that you need to adjust between different Assignment Operations).

You can find more information in the Assignment Selector Section of the Scriptable Assets Chapter.

Custom Assignment Selectors

Always the Child, Never the Parent

Any objects you assign to Streamable Cells will always be made children of a root Asset Chunk object. It is not possible to assign an object to be the root Asset Chunk itself!

If you want an object to serve as the root Asset Chunk, you will need to convert it to an Asset Chunk manually. For instance, if using prefabs you can just drag and drop the object into your Project Hierarchy. If using scenes, you can either manually add/create a new scene and drag and drop the object into the scene, or use a Scene Generator to batch generated scenes from prefabs.

Do note that the Asset Chunk names will need to follow the correct naming convention and include the Group Name of whatever LOD Group is going to use the assets! For this reason, it is sometimes easier to just use the Assignment Operation and accept that the asset will not be the root Asset Chunk.

Assigning Existing Asset Chunk Children

It is acceptable to assign game objects that are already a part of Asset Chunks when using an Assignment Operation. When you do so and it is determined that the game object needs to be moved to an Asset Chunk belonging to a different Cell, both the old Cell and new Cell have an Evaluation Operation performed for the LODs that are affected. This evaluation process may result in Asset Chunks being destroyed for the old Cell, or in the old Cell being disabled.

Assigning Objects To Disabled Cells

When a Game Object is found to fall within a Disabled Cell, the operation will automatically enable and create Asset Chunks for that Cell. Unfortunately, however, only the LOD that the operation was initiated for will have Asset Chunks created for it; if other LODs exist, they will have missing Asset Chunks until you assign game objects in the same Cells to those LODs. If you do not assign or create Asset Chunks for the other LODs, you will most certainly see errors when you play your game, as the World will expect all enabled Cells to have valid Asset Chunks for all LODs.

For this reason, it is generally recommended to only use the Assignment Operation for Game Objects that have the same number of preconfigured Levels of Detail, with each LOD game object having the same positional properties. That way, you can perform a separate Assignment Operation on each group of LOD objects, which will ensure that all Cells that are enabled have valid Asset Chunks for every LOD.

Assigning Root Asset Chunks

The Assignment Operation cannot be used on Game Objects that are the root Asset Chunks belonging to Cells. If you try to assign these objects, and error message is shown in the Console Log.

This may result in confusion in some cases because the World Designer Tool may identify an asset as a root Asset Chunk when you are not expecting it to, causing it to be unassignable.

This usually happens because the Tool has an automatic detection algorithm built into it for identifying root Asset Chunks across all World Groupings and LOD Groups. If your asset names include the Group Name from an LOD Group that you have set on a Streamable Grid in use by the Tool, and there name format matches the expected Naming Convention format of this LOD Group, it can result in the Tool mis-identifying the assets as root asset chunks.

In these cases, the easiest way to resolve the issue is to change the LOD Group's Group Name to something else.

Assigning Prefab Instances

When assigning an object that belongs to a prefab instance hierarchy, the outermost root is unpacked (unless the prefab instance is an Asset Chunk) using PrefabUtility.UnpackPrefabInstance (and PrefabUnpackMode set to OutermostRoot). With that said, if the object you assign is itself a prefab instance, it will remain a prefab instance under the new Asset Chunk.

Descendants of Assigned Objects

Assigning works just like dragging an object onto a new parent game object in that all of the objects descendants are carried along for the ride.

Incorrectly Assigned Objects

If it seems like an object is not being assigned to the correct Streamable Cell based on your observation, there are several possible reasons why it might be happening. Please take a look at the Assignment Issues Section from the FAQ for more information!

Assignment Issues

Use Cases

The main use case of the Assignment Operation is for converting an existing, large scene into a streaming friendly format. You can also use this operation when performing edits to the scene, for instance after changing an objects position you can use it to avoid having to manually calculate which Cell the object should be moved to.

Scene Conversion Tutorial