public class MoveTransformsOnWorldShift : MonoBehaviour
A MonoBehaviour that can be added to a game object in order to move multiple transforms
not
included in the World's hierarchy when the
World is shifted. The move will be carried out either before or after the World has
been
shifted, depending on how 'Move Before World Shift' is setup.
Note that you can add/remove/set the transforms at runtime as well via scripting.
Move Before World Shift | bool |
If true, the transforms will be moved before the world shift occurs. If false, the
transforms will be moved after the world shift
occurs (i.e. all transforms associated with the World have been moved).
|
Transforms To Move | Transform |
The transforms to move. Must be assigned explicitly. |
World IDs To Filter | int[] |
A set of World IDs which you can use to filter by. If set, the transforms will only be moved when the World passed into the method has an ID that matches one of the IDs set here. If no IDs are set (length = 0), all Worlds will trigger a move. Note however, this will only matter when multiple Worlds utilize the same World Shifter object that this script is subscribed to. If you only have one World using the World Shifter object, there is no need to specify a World ID. |
public void AddTransform(Transform transform)
Adds a single Transform to the internal list of transforms to move.
Name | Type | Description |
---|---|---|
transform | Transform |
The transform to add. |
public void AddTransforms(List<Transform> transforms)
Adds multiple Transforms to the internal list of transforms to move.
Name | Type | Description |
---|---|---|
transforms | List<Transform> |
The transforms to add. |
public void ClearTransforms()
Clears all Transforms currently set.
public void RemoveTransform(Transform transform)
Removes a single Transform from the internal list of transforms to move.
Name | Type | Description |
---|---|---|
transform | Transform |
The transform to remove. |
public void RemoveTransforms(List<Transform> transforms)
Removes multiple Transforms from the internal list of transforms to move.
Name | Type | Description |
---|---|---|
transforms | List<Transform> |
The transforms to remove. |
public void SetTransforms(Transform[] newTransformsToMove)
Replaces all Transforms to be moved with the ones in the input array. This clears
the existing transforms; if that
is not the behavior that you want, use AddTransforms instead.
Also note that the Transforms in the input array are copied to an internal list. The
array is not stored and used.
Name | Type | Description |
---|---|---|
newTransformsToMove | Transform[] |
The new set of Transforms to use. |
public void SetTransforms(List<Transform> newTransformsToMove)
Replaces all Transforms to be moved with the ones in the input list. This clears the
existing transforms; if that
is not the behavior that you want, use AddTransforms instead.
Also note that the Transforms in the input list are copied to an internal list. The
input list is not stored and used.
Name | Type | Description |
---|---|---|
newTransformsToMove | List<Transform> |
The new set of Transforms to use. |