https://github.com/insthync/unity-camera-and-input
A camera controller and input wrapper
https://github.com/insthync/unity-camera-and-input
Last synced: about 1 year ago
JSON representation
A camera controller and input wrapper
- Host: GitHub
- URL: https://github.com/insthync/unity-camera-and-input
- Owner: insthync
- License: mit
- Created: 2017-09-21T20:25:00.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2025-04-21T09:31:13.000Z (about 1 year ago)
- Last Synced: 2025-04-21T10:32:58.358Z (about 1 year ago)
- Language: C#
- Homepage:
- Size: 363 KB
- Stars: 13
- Watchers: 4
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# unity-camera-and-input
A collection of camera controller and input wrapper scripts
## Camera controller
- `FollowCamera` is a component which will move camera which set to `Camera` setting to follow target which set to `Target` setting.
- `FollowCameraControls` is a component which extending from `FollowCamera` to manage rotating and zooming.
* * *
## Input wrapper scripts
### How it work?
It has `InputManager` which is wrapper for mobile's on-screen joysticks to make it able to write the same input codes for mobile games and PC (or Mac or Linux).
You will have to change input codes:
- `UnityEngine.Input.GetButton(name)` to `InputManager.GetButton(name)`
- `UnityEngine.Input.GetButtonDown(name)` to `InputManager.GetButtonDown(name)`
- `UnityEngine.Input.GetButtonUp(name)` to `InputManager.GetButtonUp(name)`
- `UnityEngine.Input.GetAxisRaw(name)` to `InputManager.GetAxis(name, true)`
- `UnityEngine.Input.GetAxis(name)` to `InputManager.GetAxis(name, false)`
### Change input settings in `InputSettingManager` component instead of Unity's input manager
You can set input settings in `InputSettingManager` by add the component to empty game object, you should add it in init scene, then set input settings as you wish.
I think it's a lot more convenient to set input settings in `InputSettingManager` component, if you don't want to use it, you still can use Unity's input manager.
### Wrapper prority
Read on-screen input -> Read input setting from `InputSettingManager` -> Read input setting from Unity's input manager.
### How to test mobile on-screen joysticks in editor?
To test mobile's on-screen joysticks while running in editor, you have to set `InputManager` -> `useMobileInputOnNonMobile` to `TRUE`
### Rewired wrapper
This project is also has [Rewired](https://guavaman.com/projects/rewired/) integration, if you have it and also want to use it, you have to add `USE_REWIRED` to scripting define symbols setting.
* * *