> 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

v1.0.6

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="https://2431624982-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MY3N_li2jPq7az6mYfq%2Fuploads%2FIsiCOpF3D05v37fGLHbc%2FScreenshot%202024-09-15%20at%205.31.53%E2%80%AFPM.png?alt=media&amp;token=152ca50a-d108-46e2-980f-45747aeeb753" alt=""><figcaption></figcaption></figure>

<figure><img src="https://2431624982-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MY3N_li2jPq7az6mYfq%2Fuploads%2FuAOU6SmJV8WkRu2yW6ku%2FScreen%20Recording%202024-09-15%20at%204.21.45%E2%80%AFPM.gif?alt=media&amp;token=47ee0d18-7485-43cf-b69a-89caaa8c8123" 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="https://2431624982-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MY3N_li2jPq7az6mYfq%2Fuploads%2FmF86wVIcFzJCNNX0nNBp%2FScreenshot%202024-09-15%20at%205.35.23%E2%80%AFPM.png?alt=media&amp;token=24005706-38e3-43a8-844e-ecc1ba43d381" 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="https://2431624982-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MY3N_li2jPq7az6mYfq%2Fuploads%2FWBBee2f7OTYO7VFjSuRm%2FScreenshot%202024-09-15%20at%205.35.16%E2%80%AFPM.png?alt=media&amp;token=c22bf25d-0917-4521-bfaf-950f14411d5e" 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="https://2431624982-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MY3N_li2jPq7az6mYfq%2Fuploads%2FvXrSQI4x7DmxMqdGL4pG%2FScreenshot%202025-12-19%20at%208.16.32%E2%80%AFPM.png?alt=media&amp;token=96525e74-7e18-42af-90c0-9be8570cd7bd" 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="https://2431624982-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MY3N_li2jPq7az6mYfq%2Fuploads%2FixT4t9IoRw29mPiisZ0u%2FScreenshot%202024-09-15%20at%205.40.08%E2%80%AFPM.png?alt=media&amp;token=a9ddb4fe-b9d8-4c82-a873-88bc30092500" 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.
