WorldShiftEvent Class

public class WorldShiftEvent : UnityEvent<System.Object, WorldShiftEventArgs>

Represents a World Shift event. The intent of this class is solely to add the ability to subscribe to an event in the Unity inspector when the World is shifted. This event is not found on the World class, but is instead found in custom World Shifter classes.

The idea is to allow other scripts to receive notification exactly at the time of shifting. When a World Shifter class is setup correctly, a PreWorldShift and PostWorldShift event is fired before and after the world is shifted as a whole. If you need more fine grained control over logic that is dependent on individual transforms of the World being shifted, take a look at the TransformShiftEvent instead.

To subscribe to this event, in a separate MonoBehaviour class, create a public method with System.Object and WorldShiftEventArgs parameters. The name of the method or parameters does not matter. After saving the class, add it to a Game Object in your scene, and then in your World Shifter's inspector, add a new listener by pressing the + button on the event you care about (or both). Drag the MonoBehaviour that will be the listerner to the field that appears, and then select the method you created in the drop down list.

Alternatively, the WorldShifter has Subscribe and Unsubscribe events for hooking up listeners during runtime via code (make sure to Unsubscribe!). Usually this is done in the OnEnable and OnDisable methods of your MonoBehaviour.

The WorldShifter documentation also contains information on how to subscribe to these events, along with more detailed information.

Do not store a reference to the args when your listener is called, as the properties of the args are reset or set to null immediately after the event that uses it is done firing.