I just updated to this version for the dualsense support, but I already hit a roadblock
I am obviously doing something wrong, but I cannot figure out what!
I have this code to detect if its a playstation gamepad.
playerInput.devices[0] is DualShockGamepad
I then added this to detect if its both DualShock or dualsense, but I get an error on build. I donât know why DualSenseGamepad isnât showing up.
playerInput.devices[0] is DualShockGamepad || playerInput.devices[0] is DualSenseGamepadHID
Build Error:
Assets/Scripts/InputManager.cs(99,89): error CS0246: The type or namespace name âDualSenseGamepadHIDâ could not be found (are you missing a using directive or an assembly reference?)
Whatâs the build target? DualSenseGamepadHID is only available on some build target. Note that DualSenseGamepadHID is just a DualShockGamepad, though. So the first check alone is enough.
@TomTheMan59 It should work on iOS since 14.5, but it will not be reported as âDualSenseGamepadHIDâ due to our limitations, itâs likely to be reported as âDualShock4GampadiOSâ but I need to check. Can you give it a try and see if it works correctly?
Hi there. Iâm sure Iâm missing something obvious, but how do I upgrade the input system to 1.2.0? Iâm on Unity 2021.1.16, and the InputSystem is on 1.0.2 (according to the PackageManager->UnityRegistry page).
Weirdly, the input system doesnât show up in the PackageManager->In Project page, nor is it listed in the packages.json file. Does it somehow use a hard-coded version of the package per Unity release?
@Rob-Fireproof The reason you had to manually update is that editor/package association updates is tied to editor and those Unity âpatchesâ that are mentioned in the post will be verified and rolled out independently of the package upgrade when new Unity updates are published.
Wait what? Are you saying that the package versions that are available/recommended for a Unity version is not something thatâs fetched from Unityâs package server, but something thatâs hard-coded in each Unity version?
So you canât test a version of a package for a shipped Unity version and say âwell, this works, we can recommend this for that shipped Unity versionâ, you have to ship a new minor Unity version?
That, uh, explains things, I guess? Iâve been wondering why packages that are supposed to be available isnât available yet. But also that seems kinda horrible and not the point of packages at all. Am I missing something?
Branch 2020- of Package Manager where you could see all version was way better than this âtheorically idiot proofâ system that prevent you to see new and in pre-release package
Sadly Unity listened to the criticism that packages break projects when people willy-nilly upgrade them. So they decided to only show packages if they are either âthoroughly testedâ with the Unity version at hand or âit is experimental somewhatâ and they need people to test things.
In all other cases you need to install the package manually and if you want a specific version, you need to specify the version too.
I pretty much hate this and I predicted this BS before even they made this move, when there was a debate about this. And everyone said Iâm wrong, it will be much betterâŚ
using UnityEngine;
using UnityEngine.InputSystem.DualShock;
public class NewBehaviourScript : MonoBehaviour
{
private void Start()
{
DualSenseGamepadHID dualSense = new DualSenseGamepadHID();
dualSense.SetLightBarColor(Color.red);
}
}
This is Rumble:
using UnityEngine;
using UnityEngine.InputSystem.DualShock;
public class NewBehaviourScript : MonoBehaviour
{
private void Start()
{
DualSenseGamepadHID dualSense = new DualSenseGamepadHID();
dualSense.SetMotorSpeeds(1f, 1f);
}
}
Dualsense is connected via cable -wired-. Why is that?
I donât see a fix for GetTimeoutCompletionPercentage bug report #1377009
Code line numbers probably have changed - I posted this for 1.1.1
GetTimeoutCompletionPercentage doesnât work
Always returns 1.0. Seems to be sampling a different time than whatâs used to initialize the starttime
Unity.InputSystem\Packages\com.unity.inputsystem@1.1.1\InputSystem\Actions\InputAction.cs : 1371
Code (CSharp):
var duration = interactionState.timerDuration;
var startTime = interactionState.timerStartTime;
var endTime = startTime + duration;
var remainingTime = endTime - InputRuntime.s_Instance.currentTime;
if (remainingTime <= 0)
timerCompletion = 1;
else
timerCompletion = (float)((duration - remainingTime) / duration);
when breaking into the code âremainingTimeâ is something like -1200.0
Looks like timerStartTime is an offset from some value whereas InputRuntime.s_Instance.currentTime is the current realtime value.
Specifically timerStartTime is set by :
Unity.InputSystem\Packages\com.unity.inputsystem@1.1.1\InputSystem\InputManager.cs : 3447
Code (CSharp):
var currentTime = m_Runtime.currentTime - InputRuntime.s_CurrentTimeOffsetToRealtimeSinceStartup;
The fix is to fix the remainingTime calculation to use the same offset time value used for startTime
Code (CSharp):
var duration = interactionState.timerDuration;
var startTime = interactionState.timerStartTime;
var endTime = startTime + duration;
var remainingTime = endTime - (InputRuntime.s_Instance.currentTime - InputRuntime.s_CurrentTimeOffsetToRealtimeSinceStartup);
if (remainingTime <= 0)
timerCompletion = 1;
else
timerCompletion = (float)((duration - remainingTime) / duration);
Is there a function to detect any key on any device was pressed, yet?
e.g.
using UnityEngine;
public class NewBehaviourScript : MonoBehaviour
{
private void Update()
{
if (Device.current.AnyKey.wasPressedThisFrame)
{
//Do something..
}
}
}