---
# System prepended metadata

title: unity

---

# unity
## joystick
### 左右移動部分
1. add joystick into unity
2. add "Fixed Joystick" into convas
3. 在playermovement裡面新增一個 public joystick
![](https://i.imgur.com/EE4olsC.png)
4. 修改update裡面的horizontalMove
![](https://i.imgur.com/mw7Ersq.png)

### 攻擊跳躍部分
1. 新增"JUMP", "ATTACK", "LEGATTACK" button到canvas內
![](https://i.imgur.com/t1x4kRt.png)

2. 將playermovement的jump改成public static
![](https://i.imgur.com/wMN3DtJ.png)


3. 新增一個"empty obj"並建立一個Script
![](https://i.imgur.com/P4HOuGm.png)
![](https://i.imgur.com/aExV9gY.png)

4. button新增 onclick動作
![](https://i.imgur.com/s2moVsQ.png)


