public abstract class AssignmentSelector : ScriptableObject
A Scriptable Object class you can derive from to create custom logic for choosing
what objects are selected for assignment operations.
The selection process works like so:
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, the child's Transform component is passed to
the IsMatch method. If
the method returns a value of true, the search stops for that specific child's hierarchy
and the next sibling
is searched. If it returns false, the search continues drilling down into that child's
hierarchy until a match
is found or no more children exist. After drilling all the way down or finding a match,
the search moves
back up one level and searches all siblings of the last parent transform that was
searched. This
strategy ensures that descendants of a selected object cannot also be selected, which
would be problematic if allowed.
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.
public abstract bool IsMatch(Transform transform)
Checks whether the game object associated with the input transform should be included in the current Assignment Operation.
Name | Type | Description |
---|---|---|
transform | Transform |
The transform associated with the game object that you should check. |
type
Return true if the game object is a match (meaning it should be included in the selection
of objects
which will be assigned), or false otherwise.
public virtual void OnAssignmentStarting(World world, int groupingIndex, int LOD)
Called before an Assignment Operation has begun. This can be overriden to perform setup/configuration, for instance your IsMatch method should return true only if the input transform's game object has a specific tag, you can use this to set the tag to use in the comparison, based on the World, groupingIndex, and/or LOD values.
Name | Type | Description |
---|---|---|
world | World |
The World that the current Assignment Operation is assigning objects to. |
groupingIndex | int |
The index of the World Grouping that the current Assignment Operation is assigning objects to. |
LOD | int |
The index of the LOD Group that the current Assignment Operation is assigning objects to. |