diff --git a/Packages/com.unity.inputsystem/InputSystem/Devices/Mouse.cs b/Packages/com.unity.inputsystem/InputSystem/Devices/Mouse.cs
index 5ef58fbbec..814082b117 100644
--- a/Packages/com.unity.inputsystem/InputSystem/Devices/Mouse.cs
+++ b/Packages/com.unity.inputsystem/InputSystem/Devices/Mouse.cs
@@ -1,3 +1,4 @@
+using System.ComponentModel;
using System.Runtime.InteropServices;
using UnityEngine.InputSystem.Controls;
using UnityEngine.InputSystem.Layouts;
@@ -223,6 +224,30 @@ public class Mouse : Pointer, IInputStateCallbackReceiver
/// Control representing the mouse click count.
public IntegerControl clickCount { get; protected set; }
+ ///
+ /// Retrieve a mouse button by its enumeration
+ /// constant.
+ ///
+ /// Button to retrieve.
+ /// is not a valid mouse
+ /// button value.
+ public ButtonControl this[MouseButton button]
+ {
+ get
+ {
+ switch (button)
+ {
+ case MouseButton.Left: return leftButton;
+ case MouseButton.Right: return rightButton;
+ case MouseButton.Middle: return middleButton;
+ case MouseButton.Forward: return forwardButton;
+ case MouseButton.Back: return backButton;
+ default:
+ throw new InvalidEnumArgumentException(nameof(button), (int)button, typeof(MouseButton));
+ }
+ }
+ }
+
///
/// The mouse that was added or updated last or null if there is no mouse
/// connected to the system.