On-Screen Control Problem

atmuc

Member
I use On-Screen controls like this;


Actions like Jump, Fire2 (Zoom) works with that controller. I have a problem with Fire action. That control creates a virtual GamePad device. All actions work with my physical gamepad. Only Fire action does not work with the virtual gamepad. There are 2 differences between using the virtual and physical gamepad.

  1. On the physical gamepad right trigger data type is BYTE, on the virtual gamepad, it is FLOAT
  2. On the physical gamepad trigger value goes to 1.0f gradually, on the virtual game it goes from 0.0f to 0.1f directly.
I use that code to pair virtual gamepad. I don't use Auto-Switch on the Player Input component.

var device = InputSystem.devices.FirstOrDefault(a => a.name == "Gamepad");
if (device != null)
{
InputUser.PerformPairingWithDevice(device, _playerInput.user);
}

I can see that PlayerInput Fire1 and Fire2 actions are generated by the virtual gamepad. I have that code in a component on the same gamepad with the UCC character gameobject.

public void OnFire1(InputValue value)
{
var inputValue = value.Get<float>();
Debug.LogFormat("OnFire1:{0}", inputValue);
}

What is the difference between Fire and other actions?
 
I'm not sure exactly how they've set up that specific virtual controller, but is there any reason you're using that rather than the built-in virtual controls (or one of the recommended packages like Control Freak or Easy Touch)?
 
I use new unity input system. As I remember, built-in virtual controls are not compatible with unity input system.

Error: The character NolanST has no UnityInput component.
 
Top