> For the complete documentation index, see [llms.txt](https://infinitypbr.gitbook.io/magic-pig-games/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://infinitypbr.gitbook.io/magic-pig-games/magic-time-local-time-scale/time-zone.md).

# Time Zone

A **Time Zone** is an area, defined by a `collider`, with its own [**Local Time Scale**](/magic-pig-games/magic-time-local-time-scale/local-time-scale.md). Anything passing through this zone will automatically subscribe to the Local Time Scale, and unsubscribe as they leave the zone.

<figure><img src="/files/f1KQS4O515zEIvhwyQJw" alt=""><figcaption></figcaption></figure>

<figure><img src="/files/VpwozsFgQexCLuzV7wFQ" alt=""><figcaption><p>The blue zone is a Time Zone!</p></figcaption></figure>

## Create a new `LocalTimeScale` at Runtime

The Time Zone is able to create its own new `LocalTimeScale` object at runtime, with a default starting value that you define.

Check the "*Create new Local Time Scale*" button to enable this, and then set the starting value you'd like.

<figure><img src="/files/ZnwydYRAFagV7LHnDsU6" alt=""><figcaption></figcaption></figure>

## Copy an Existing `LocalTimeScale` Scriptable Object

Alternatively, you can choose to use an existing LocalTimeScale Scriptable Object which you've created in your project. At runtime, a new instance of this will be created, with the starting value defined in that object.

This is a good way to utilize `LocalTimeScale` objects with a custom derived class that you've created for your project.

<figure><img src="/files/2AwefgWTrWTgsRn0HtAb" alt=""><figcaption></figcaption></figure>

{% hint style="warning" %}
Even when multiple Time Zone objects use the same `LocalTimeScale` Scriptable Object, each will have its own unique instance of the object.
{% endhint %}

## TimeZone Events

There are Unity Events for `OnObjectEnter` and `OnObjectExit` which you can populate in the Inspector. These events pass a `TimeZoneEventData` objcet, which contains the `GameObject` that triggered the event, the `Collider` of that object, and the `Vector3` contactPoint.

<figure><img src="/files/dXhjwZMoIaMIeIBroL4q" alt="" width="375"><figcaption></figcaption></figure>

## Runtime Information

Viewing the Inspector at runtime will display any Subscribers currently subscribed to this objects `LocalTimeScale`.

<figure><img src="/files/dCe3K6DZwAu1ZAlOJmrv" alt=""><figcaption></figcaption></figure>

You can ping the objects if you'd like to see specifically which object it is, and also remove it from the list -- useful for debugging.
