Hey guys,
I’m making a game for both controller and keyboard/mouse and I was wondering how stable the new input system is? Will I be able to use it without major hiccups in 2019.1 or is it too early?
Is it subject to major changes in the future?
Hey guys,
I’m making a game for both controller and keyboard/mouse and I was wondering how stable the new input system is? Will I be able to use it without major hiccups in 2019.1 or is it too early?
Is it subject to major changes in the future?
Depending what you call production ready. If you expect seamless usage and unhindered development, it’s not.
If you have time (I would say at least a year until ship), then you may better off starting to implement.
I don’t think it will change considerably in the future, but of course, it’s a preview package, so you never know. This is why it’s important that you don’t try to use it close to your deadline.
It is not production ready. Things change regularly.
Yes, you can still expect one or two batches of changes come in over the next weeks. But after that we expect all feature work to be done, and to focus on polishing and shipping a 1.0 release this summer. So depending on your time frame, if you are ok with some code-changing disruptions coming in the next weeks, slowing down soon after that, you should probably by fine starting to use it now.
Great, I’ll start using it then
I was testing it out and I haven’t been able to reproduce the UnityEngine.Input behaviour for the gamepad stick.
Here’s what I’m trying to reproduce:
Vector2 MoveAxis = new Vector2(Input.GetAxis("Horizontal"), Input.GetAxis("Vertical"));
In the new input system:
the Move Action I created is supposed to do the same. However, whenever I stop moving the stick, the Vector2 I read from the Move action does not always equal to Vector2.zero and thus my character keeps on moving.
Here’s the script I’m using:
using UnityEngine;
using UnityEngine.Experimental.Input;
[RequireComponent(typeof(Player))]
public class PlayerInput : MonoBehaviour
{
public float MoveSpeed = 7f;
private Player Player; // A reference to the Control on the object
private bool Jump; // the world-relative desired move direction, calculated from the camForward and user input.
void OnEnable()
{
Inputer.Control.Player.Move.performed += MoveOnPerformed;
Inputer.Control.Player.Jump.performed += JumpOnPerformed;
Inputer.Control.Player.Weapon.performed += WeaponOnPerformed;
}
void OnDisable()
{
Inputer.Control.Player.Move.performed -= MoveOnPerformed;
Inputer.Control.Player.Jump.performed -= JumpOnPerformed;
Inputer.Control.Player.Weapon.performed -= WeaponOnPerformed;
}
private void JumpOnPerformed(InputAction.CallbackContext _callbackContext)
{
Player.Control.Jump();
}
private void WeaponOnPerformed(InputAction.CallbackContext _callbackContext)
{
Player.AttackNow();
}
private Vector2 MoveAxis;
private void MoveOnPerformed(InputAction.CallbackContext _callbackContext)
{
var value = _callbackContext.ReadValue<Vector2>();
if (value.magnitude > .1f)
MoveAxis = value;
else MoveAxis = Vector2.zero;
}
private void Start()
{
Player = GetComponent<Player>();
}
// Fixed update is called in sync with physics
private void FixedUpdate()
{
// MoveAxis = new Vector2(Input.GetAxis("Horizontal"), Input.GetAxis("Vertical")); // this gives me proper values unlike the MoveOnPerformed
var dir = new Vector3(MoveAxis.x, 0f, MoveAxis.y);
Player.Move(MoveSpeed * dir);
}
}
I’ve been using it for a few weeks now and the new input system is really amazing, it’s super flexible! Great job jonas-echterhoff
I know this is not out of preview yet, but as of today, can I safely replace SteamVR plugin? Does this support, Valve (index, vive), Oculus, and WMR Controllers?
Is it possible your hardware stick doesn’t sit at 0, 0 when it’s not being used? You could define a threshold, to only move the characters once the Vector magnitude is greater than a certain value.
The Input System does support these, but the support is actually being moved out of the Input System package as I’m writing this. Input System 1.0 will be without XR support out of the box. The reason is that the XR team wants to have more control over releasing changes to this, and is moving XR support into separate packages (using the new Input System). These should probably show up a few weeks from now.
Guess I will be waiting for bit longer. Appreciate the update!
I have this same issue. It is not a deadzone issue, it’s that the event doesn’t get fired when the stick returns to 0,0 so the last positive value in the previous frame remains. Very annoying bug.
Are you looking at both performed
and canceled
callbacks?
@jonas-echterhoff_1 Hi, sorry to bother you on this thread. I will create a new one if it’s better to do so. I was wondering if there is any documentation or tutorials, or if it has supported API to have haptic feedback in new input system. I have found this - Class Gamepad | Package Manager UI website , but it’s hard to tell how to use it in correct way without smell code and if it works at all the way I see it could work. I intend to resume and pause haptic in coroutine, is this the right way? Is there any example where I can look it up?
Yes, a new thread would be appreciated for new topics.
Your link is old - we added a lot of documentation since then, the current version docs is at https://docs.unity3d.com/Packages/com.unity.inputsystem@1.0/api/UnityEngine.InputSystem.Gamepad.html#UnityEngine_InputSystem_Gamepad_PauseHaptics
@jonas-echterhoff_1 I have the same problem when using Player Input script.
I have Move control group that binds to left gamepad stick. As far as I can understand from auto-generated file, all events (started, performed, cancelled) call the same function:
public void SetCallbacks(IGameplayActions instance)
{
if (m_Wrapper.m_GameplayActionsCallbackInterface != null)
{
Move.started -= m_Wrapper.m_GameplayActionsCallbackInterface.OnMove;
Move.performed -= m_Wrapper.m_GameplayActionsCallbackInterface.OnMove;
Move.canceled -= m_Wrapper.m_GameplayActionsCallbackInterface.OnMove;
}
m_Wrapper.m_GameplayActionsCallbackInterface = instance;
if (instance != null)
{
Move.started += instance.OnMove;
Move.performed += instance.OnMove;
Move.canceled += instance.OnMove;
}
}
So in the actual player controller script I read the axis value like this:
//....
private Vector2 _moveInput;
//...
void OnMove(InputValue value)
{
// i guess this should be called on started, performed and cancelled
_moveInput = value.Get<Vector2>();
}
void FixedUpdate()
{
print(_moveInput);
}
Sometimes it does reset to 0,0, sometimes it does not (very easy to reproduce with quick stick flick) and stays at something like (0.4, -0.3). The legacy input system worked fine with the same approach, so I can’t blame the gamepad for sure.
How so I fix this?
By the way, the Behaviour setting of player input script is set to “send messages” if that’s somehow important.
GetComponent<PlayerInput>().actions["move"].ReadValue<Vector2>()
returns correct value at the same time.
So what should I do to use OnMove() correctly?
Does this happen when you try to move your stick in a circular pattern? It might have to do with removed continuous
.
@MaxKarpinsky i don’t think the movement pattern before letting off the stick matters. What seems to matter is letting go off the stick from any position as fast as possible, so the spring shoots it back to the center. This is what triggers that problem, that’s why I thought that “cancelled” does not trigger.
What is your action type? It should be “Value”.
@jonas-echterhoff_1 seems like it was the case.
Action was set to “Button” (default one). Changing to Action “Value” with Controlt Type “Any” fixed the issue for me.
Tnank you so much.