system
1
|
|
|
|
Attention |
Topic was automatically imported from the old Question2Answer platform. |
|
Asked By |
petr0m |
How can I connect the signal joy_connection_changed
in c#?
Is there a way to get the Input singleton reference so that I can connect the signal?
Thanks in advance!
system
2
|
|
|
|
Reply From: |
juppi |
Hi petr0m,
here you go:
public override void _Ready()
{
Input.Singleton.Connect("joy_connection_changed", this, nameof(OnJoyConnectionChanged));
}
private void OnJoyConnectionChanged(int device, bool connected)
{
}
This will give you the Id of the Gamepad and tells you if its connected or removed.
But yes, this was not obvious. I had to read the docs too:
Awesome, thanks this worked!
petr0m | 2022-09-24 11:07