godotengine / godotengine/godot-docs

Add documentation around InputEvent Device ID

Open
#7,951 3 comments 2 reactions 0 assignees View on GitHub
area:class reference enhancement topic:input
Dominant language
reStructuredText
Stars
5.7k
Forks
3.8k
Avg merge
1d 20h
Merged PRs (30d)
25

Description

**Your Godot version:**
4.1.1 C# Windows

**Issue description:**
InputEvent.Device does not have much documentation around it, & gives users the impression that it is a unique ID per device. However, (at least on my editor) it appears that the behavior is instead to assign device IDs that are unique to the device type (keyboard, mouse, joypad). If this is behavior that is consistent across platforms then this would be extremely helpful to document, given that this number is used by multiple methods of Input.

**Valdiation:**
Given the following code:
```cs
public partial class Foobar : Node3D
{
public override void _Input(InputEvent e)
{
GD.Print(e.Device + "\t" + e.AsText());
}
}
```
1. Make an input with the keyboard - device ID is 0
2. Make an input with the mouse - device ID is 0
3. Make an input with a joypad - device ID is 0
4. Make an input with a second joypad - device ID is 1

**URL to the documentation page (if already existing):**
https://docs.godotengine.org/en/stable/classes/class_inputevent.html#property-descriptions

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.