StandardAssets (Mobile) Joystick activates Input Axis with mouse 0/1 attached (Android)

In my project I defined two Axes in the Input settings (Edit → Project Settings → Input), Fire 1 and Fire 2:

  • Positive Button of “Fire 1” is “mouse 0”
  • Positive Button of “Fire 2” is “mouse 1”

The corresponding update script of the player is as following:

	void Update () {
		if (Input.GetAxis("Fire 1") != 0)
			spawnWeaponMain ();

		if (Input.GetAxis("Fire 2") != 0)
			spawnWeaponSecond ();
	}

As input for my mobile Android device I’m using the default, unaltered Dual Joystick Prefab provided by Unity (v4.3.4) StandardAssets (Mobile).

  • When tapping on LeftJoystick or RightJoystick then Input.GetAxis("Fire 1") != 0 is true.
  • When tapping LeftJoystick and RightJoystick simultaneously, Input.GetAxis("Fire 2") != 0 is true.

Both is unexpected behavior.(?)

Now when I remove mouse 0, mouse 1 from the Input Axis definition, Input.GetAxis("Fire 1") != 0 and Input.GetAxis("Fire 2") != 0 work as expected, both statements remain false when using the Joystick.

In the default Joystick.js I can’t find where “mouse 0” and “mouse 1” are fired. Could someone point me in the right direction?

In fact this has nothing to do with the standard joystick script but with the fact, that on touch devices “mouse 0” is triggered on tap and “mouse 1” is triggered on multitouch tap.

Therefore

if (Input.GetMouseButtonDown(0)) // True for single tap.
if (Input.GetMouseButtonDown(1)) // True for multitouch tap.