---
# System prepended metadata

title: While Coding

---

# While Coding
There are two way to Scripting with GameTickSystem.

## 【Create Script from my options】
### 1. Create New Script from **Assets/Create/NaiveAPI/C# TickScript**
![](https://i.imgur.com/MNfltDs.png)
![](https://i.imgur.com/hkRzucR.png)

### 2. Setting update frequency
Change tickUpdate.Subscribe()'s param.
Default is Update TickRate.
![](https://i.imgur.com/PeQLHgF.png)

:::info
**Update with every Tick Rate**
``` csharp=
   tickUpdate.Subscribe();
or tickUpdate.Subscribe(1);
or tickUpdate.Subscribe(false);
``` 
**Update with Custom tick interval** (based on Tick Rate)
``` csharp=
   tickUpdate.Subscribe(int updateFrequency);
``` 
**Update with Real Tick** (change tick rate will not effect on this):
``` csharp=
   tickUpdate.Subscribe(true);
```
:::


---
## 【Add ITickUpdate by yourself】
### 1. Add Interface "ITickUpdate".
![](https://i.imgur.com/Cz6Yw0T.png)

### 2. Coding in TickUpdate() (same as in Update()).
![](https://i.imgur.com/SNr2MPa.png)

### 3. Subscribe to GameTickManager at Start() or Awake().
![](https://i.imgur.com/GDzkG8r.png)

---
## 【Things you have to know】

:::danger
- **With out Subscribe ( ![](https://i.imgur.com/PeQLHgF.png) and others ),
your code in TickUpdate() will not implement by GameTickManager.**

- **Do not use ![](https://i.imgur.com/dkKH3qE.png) it make many problem
See Also :** [**Why GetKey make problem in GameTickSystem**](/Il4jc_pqRrWfSv4s9RRLGg)
**Use this to replace it.**
``` csharp=
    private GameTickManager gameTick;
    private void Start()
    {
        gameTick = GameTickManager.Instance;
    }
    public void TickUpdate()
    {
        gameTick.GetKey(KeyCode.Mouse0);
        gameTick.GetKeyDown(KeyCode.Mouse0);
        gameTick.GetKeyUp(KeyCode.Mouse0);
    }

/*-------------------- or -----------------------*/

    public void TickUpdate()
    {
        GameTickManager.Instance.GetKey(KeyCode.Mouse0);
        GameTickManager.Instance.GetKeyDown(KeyCode.Mouse0);
        GameTickManager.Instance.GetKeyUp(KeyCode.Mouse0);
    }

```

:::
:::info
- **You can use ![](https://i.imgur.com/gXYvp8V.png) to stop update this script,
also can restart by use Subscribe() again.**
:::