Skip to content
Dominik Winkelbauer edited this page Jun 25, 2017 · 3 revisions

Input

Adjust your code

Specify your keys

Every key, button and axis you want to use in your application has to be registered at the Synchronizer prefab.

Replace methods

All you have to do is to use the methods our package provides instead of the classic Unity ones.

UnityEngine CAVE
Input.GetAxis(string axisName) InputSynchronizer.GetAxis(string axisName)
Input.GetButton(string buttonName) InputSynchronizer.GetButton(string buttonName)
Input.GetButtonDown(string buttonName) InputSynchronizer.GetButtonDown(string buttonName)
Input.GetButtonUp(string buttonName) InputSynchronizer.GetButtonUp(string buttonName)
Input.GetKey(string name) InputSynchronizer.GetKey(string name)
Input.GetKeyDown(string name) InputSynchronizer.GetKeyDown(string name)
Input.GetKeyUp(string name) InputSynchronizer.GetKeyUp(string name)
Input.GetMouseButton(int button) InputSynchronizer.GetMouseButton(int button)
Input.GetMouseButtonDown(int button) InputSynchronizer.GetMouseButtonDown(int button)
Input.GetMouseButtonUp(int button) InputSynchronizer.GetMouseButtonUp(int button)
- InputSynchronizer.GetFlyStickButton(int buttonChannel)
- InputSynchronizer.GetFlyStickButtonDown(int buttonChannel)
- InputSynchronizer.GetFlyStickButtonUp(int buttonChannel)

What does not work?

  • GetKey*() methods do not support KeyCode parameter

How it works

At the beginning of every Update() call the master sends the current axes and button states to all slaves. Axes states are sent every frame, buttons/keys only if they are pressed.

Package

InputInputMessage
int axesLength
Axis[] axes
int buttonsLength
Button[] buttons

Subpackages

Axis
int id
float value
Button
short inputType
int id

(inputType = ButtonDown or KeyDown)

Clone this wiki locally