skinwalker
Member
Hello,
I'm using the new unity input system and I noticed problems when the player dies and PlayerInput is disabled - the default behavior.
After the player dies I show UI, where you have to click a button to respawn, the problem is that even though the button is registering highlight events, click events (visually), none of the on click actions are triggered unless I click the button 2 or 3 times.
The problem appears after the first respawn (you need to die twice to trigger the bug, then after than on each death you won't be able to fire button events unless you click it 2 or 3 times). It happens with any kind of UI.
The only way to fix the issue is to open PlayerInput.cs and go to line 500 and comment out the "enabled = m_AllowInput && !m_Death;"
I also couldn't find a reason why PlayerInput gets disabled when using the new unity input system, even if I remove that line and the script stays active while the player is dead I still can't move the player around, so I don't see a point in disabling this script, or maybe there's another rare case scenario and you have to disable it?
-----
A way to replicate it:
1. Use latest UCC + latest Unity Input System
2. Create a simple script that shows a button when you press a key or when you die, add an onclick event to the button to make it's text disappear or something simple like that
3. Get killed by NPC or jump off a cliff
4. Show the UI with the button
on the first trial the click will register properly
5. Respawn
6. Die again
7. Show the UI again with the button, now it will take 2 or 3 clicks to trigger the on click event
from here every time you die, none of your button UIs will register clicks unless you click on them multiple times.
I'm using the new unity input system and I noticed problems when the player dies and PlayerInput is disabled - the default behavior.
After the player dies I show UI, where you have to click a button to respawn, the problem is that even though the button is registering highlight events, click events (visually), none of the on click actions are triggered unless I click the button 2 or 3 times.
The problem appears after the first respawn (you need to die twice to trigger the bug, then after than on each death you won't be able to fire button events unless you click it 2 or 3 times). It happens with any kind of UI.
The only way to fix the issue is to open PlayerInput.cs and go to line 500 and comment out the "enabled = m_AllowInput && !m_Death;"
private void OnDeath(Vector3 position, Vector3 force, GameObject attacker)
{
m_Death = true;
// enabled = m_AllowInput && !m_Death;
}
I also couldn't find a reason why PlayerInput gets disabled when using the new unity input system, even if I remove that line and the script stays active while the player is dead I still can't move the player around, so I don't see a point in disabling this script, or maybe there's another rare case scenario and you have to disable it?
-----
A way to replicate it:
1. Use latest UCC + latest Unity Input System
2. Create a simple script that shows a button when you press a key or when you die, add an onclick event to the button to make it's text disappear or something simple like that
3. Get killed by NPC or jump off a cliff
4. Show the UI with the button
on the first trial the click will register properly
5. Respawn
6. Die again
7. Show the UI again with the button, now it will take 2 or 3 clicks to trigger the on click event
from here every time you die, none of your button UIs will register clicks unless you click on them multiple times.