Hello people, I was trying to implement some unit tests for my Unity project during the last few days and I seem to have run into a problem ^^". Whenever I try to instantiate a Keyboard() Object, it seemingly returns null. My code at the moment looks like this (I put it in a small function which produces the same error):
[UnityTest]
public IEnumerator CanPressButtons()
{
var keyboard = new Keyboard();
yield return keyboard;
Press(keyboard.wKey);
}
and this produces the following Test error:
System.NullReferenceException : Object reference not set to an instance of an object
at UnityEngine.InputSystem.Keyboard.get_Item (UnityEngine.InputSystem.Key key) [0x00005] in [ProjectPath]\Library\PackageCache\com.unity.inputsystem@1.4.2\InputSystem\Devices\Keyboard.cs:1965
at UnityEngine.InputSystem.Keyboard.get_wKey () [0x00000] in [ProjectPath]\Library\PackageCache\com.unity.inputsystem@1.4.2\InputSystem\Devices\Keyboard.cs:1274
at CameraTests+d__1.MoveNext () [0x00047] in [ProjectPath]\Assets\Tests\PlayModeTests\CameraTests.cs:42
at UnityEngine.TestTools.TestEnumerator+d__7.MoveNext () [0x0004e] in [ProjectPath]\Library\PackageCache\com.unity.test-framework@1.1.33\UnityEngine.TestRunner\NUnitExtensions\Attributes\TestEnumerator.cs:46
I would be delighted if someone could help me fix this bug.
Thank you all in Advance! ^^