# SimpleScript.OnTimerOptionsAttribute

Kind: Class · Namespace: Sansar.Simulation · Assembly: Sansar.Simulation.dll · Script API 47.10.0

<div class="api-meta">
<span class="api-kind api-kind-class" data-pagefind-filter="kind:Class">Class</span>
<span data-pagefind-filter="namespace:Sansar.Simulation">Namespace <a href="/scripting/api/sansar.simulation"><code>Sansar.Simulation</code></a></span>
<span>Inherits <a href="/scripting/api/sansar.simulation/simplescript.simplescriptoptionsattribute">SimpleScript.SimpleScriptOptionsAttribute</a></span>
</div>

<span id="T:Sansar.Simulation.SimpleScript.OnTimerOptionsAttribute"></span>

Set options for OnTimer() overrides, or use to create more simple timers.

```csharp
[System.AttributeUsage(System.AttributeTargets.Method, AllowMultiple=false)]
[System.Obsolete("SimpleScript is deprecated and will not receive new features. Please use SceneObjectScript or ObjectScript.", false)]
protected class SimpleScript.OnTimerOptionsAttribute : SimpleScript.SimpleScriptOptionsAttribute
```

## Remarks

This attribute is optional when overriding OnTimer which by default will run once per second.

 Add this attribute to any method that matches Action&lt;&gt; to create extra timers.

```csharp
[OnTimerOptions(Rate=5)]
            void TimerEvery5()
            {
               // run every 5 seconds
            }
              
            void OnTimer()
            {
               // run every 1 second
            }
```

## Example

```csharp
// Run this timer every 5 seconds
[OnTimerOptions(Rate=5)]
protected override OnTimer()
```

## Members at a glance

| Kind | Members |
|---|---|
| **Constructors** | [OnTimerOptionsAttribute](#ontimeroptionsattribute) |
| **Fields** | [MinimumRate](#minimumrate) |
| **Properties** | [Rate](#rate) |

## Constructors

### OnTimerOptionsAttribute

<div class="api-card">
<span id="M:Sansar.Simulation.SimpleScript.OnTimerOptionsAttribute.#ctor"></span>
<span id="C:Sansar.Simulation.SimpleScript.OnTimerOptionsAttribute()"></span>

```csharp signature
public SimpleScript.OnTimerOptionsAttribute()
```



</div>


## Fields

### MinimumRate

<div class="api-card">
<span id="F:Sansar.Simulation.SimpleScript.OnTimerOptionsAttribute.MinimumRate"></span>
<div class="api-badges"><span class="api-badge api-deprecated">Deprecated</span></div>

```csharp signature
[System.Obsolete("SimpleScript is deprecated and will not receive new features. Please use SceneObjectScript or ObjectScript.", false)]
public readonly double MinimumRate
```

Minimum value for Rate is 0.025, which is 40 times per second.

</div>


## Properties

### Rate

<div class="api-card">
<span id="P:Sansar.Simulation.SimpleScript.OnTimerOptionsAttribute.Rate"></span>
<div class="api-badges"><span class="api-badge api-deprecated">Deprecated</span></div>

```csharp signature
[System.Obsolete("SimpleScript is deprecated and will not receive new features. Please use SceneObjectScript or ObjectScript.", false)]
public double Rate { get; set; }
```

Set the rate in seconds between events.

**Value:** [double](https://learn.microsoft.com/dotnet/api/system.double) — The value in seconds between OnTimer events.

<details class="api-remarks"><summary>Remarks</summary>

A Rate of 1 would call OnTimer once every second, 0.1 would call OnTimer 10 times every second, and 10 would call OnTimer once every 10 seconds.

Minimum value for Rate is 0.025, which is 40 times per second.

</details>

<details class="api-example" open><summary>Example</summary>

```csharp
// Set OnTimer to happen every 0.2 seconds.
[OnTimerOptions(Rate=0.2)]
protected override void OnTimer(Int64 frame)
```

</details>

</div>




<p class="api-generated" data-pagefind-ignore>Generated from the Sansar 47.10.0 client ScriptApi snapshot.</p>