Skip to content

Commit 3cb2198

Browse files
committed
fix(Input): Fixed mouse input not working when VR headset is connected
1 parent 6c38855 commit 3cb2198

File tree

5 files changed

+11
-17
lines changed

5 files changed

+11
-17
lines changed

.gitignore

+4
Original file line numberDiff line numberDiff line change
@@ -78,3 +78,7 @@ omnisharp.json
7878

7979
# Rider
8080
.idea/
81+
82+
Assets/Scripts/Portal/SwapSystem/SwapUtility_LEGACY.cs
83+
84+
Assets/Scripts/Portal/SwapSystem/SwapUtility_LEGACY.cs.meta

Assets/Scripts/Player/KBMPlayer.cs

+4-9
Original file line numberDiff line numberDiff line change
@@ -30,15 +30,6 @@ public class KBMPlayer : PlayerBase
3030

3131
private PlayerInputAction.KBMPlayerActions playerActions;
3232

33-
protected override void Awake()
34-
{
35-
base.Awake();
36-
var playerInputAction = new PlayerInputAction();
37-
playerInputAction.Enable();
38-
this.playerActions = playerInputAction.KBMPlayer;
39-
grabJoint = GetComponent<TeleportableJoint>();
40-
}
41-
4233
private void OnValidate()
4334
{
4435
var joint = GetComponent<ConfigurableJoint>();
@@ -49,6 +40,10 @@ private void OnValidate()
4940

5041
private void Start()
5142
{
43+
var playerInputAction = new PlayerInputAction();
44+
playerInputAction.Enable();
45+
this.playerActions = playerInputAction.KBMPlayer;
46+
grabJoint = GetComponent<TeleportableJoint>();
5247
this.playerActions.Grab.started += _ => OnGrab();
5348
}
5449

Assets/Scripts/Player/PlayerInputAction.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ public @PlayerInputAction()
107107
""path"": ""<Mouse>/delta"",
108108
""interactions"": """",
109109
""processors"": """",
110-
""groups"": ""KBM"",
110+
""groups"": """",
111111
""action"": ""Look"",
112112
""isComposite"": false,
113113
""isPartOfComposite"": false

Assets/Scripts/Player/PlayerInputAction.inputactions

+1-1
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@
8585
"path": "<Mouse>/delta",
8686
"interactions": "",
8787
"processors": "",
88-
"groups": "KBM",
88+
"groups": "",
8989
"action": "Look",
9090
"isComposite": false,
9191
"isPartOfComposite": false

Assets/Scripts/Player/VRPlayerHand.cs

+1-6
Original file line numberDiff line numberDiff line change
@@ -31,14 +31,9 @@ public class VRPlayerHand: MonoBehaviourBase
3131
private Grabbable holdingItem;
3232
private List<Grabbable> grabbableItems = new();
3333

34-
35-
private void Awake()
36-
{
37-
GetComponentInChildren<Renderer>().material.color = Color.red;
38-
}
39-
4034
private void Start()
4135
{
36+
GetComponentInChildren<Renderer>().material.color = Color.red;
4237
this.playerInput = FindObjectOfType<VRPlayerInput>();
4338

4439
// Register hand to player input events

0 commit comments

Comments
 (0)