Give Page Feedback | API

Hierarchy Organizers - How To Create Custom Hierarchy Organizers

Custom Hierarchy Organizers can be used to create unique hierarchies not achievable with the Standard Hierarchy Organizer

In order to create a custom Hierarchy Organizer, start by creating a new MonoBehaviour script that derives from the HierarchyOrganizer base abstract class.

You should place your class inside of the DeepSpaceLabs.SAM namespace, which will make the HierarchyOrganizer class available and also help avoid naming conflicts with 3rd party assets or your own code.

--Special Note--
An easy way to start with your custom class is to hover over your custom class name and choose the option Show potential fixes -> Implement abstract class. This will provide default overrides for all abstract class members.

In addition, we recommend adding the following attribute above your class, which will ensure the custom chunk manager is shown with other Hierarchy Organizers in menus:

[AddComponentMenu(GlobalValues.COMPONENT_ROOT_PATH + "Hierarchy Organizers/Custom Hierarchy Organizer Name")]

InitializeAdditional (Method - Implementation Optional)

Worlds initialize Hierarchy Organizers using an Initialize Method, which allows the World and a transform pooling object to be passed to it. If you wish to execute other initialization related code, you can override this method, which is called automatically by the base HierarchyOrganizer after its own initialization code is run.

AddChunkToHierarchy (Method - Implementation Required)

When overridden, should add an Asset Chunk to the Hierarchy.

The World Cell that the Asset Chunk belongs to is also passed along with this method. You can use information from this World Cell to decide on where to place the Asset Chunk in the Hierarchy.

RemoveChunkFromHierarchy (Method - Implementation Required)

When overridden, should remove an Asset Chunk from the Hierarchy.

The World Cell that the Asset Chunk belongs to is also passed along with this method. You can use information from this World Cell to make finding the Asset Chunk within the Hierarchy easier.

A Note On Game Objects

While Hierarchy Organizers are primarily intended to be used with Game Objects and the Scene Hierarchy, the two methods listed above actually pass in the Asset Chunks as System.objects rather than GameObjects.

This allows you to organize non-Game Objects, although I cannot imagine how this would be done.