Skip to content

Commit

Permalink
Try fix command key status in windows
Browse files Browse the repository at this point in the history
  • Loading branch information
xiaoguzhu committed Jul 29, 2020
1 parent 03f43d6 commit b898318
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions Assets/Scripts/Event/InputEvent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,7 @@ public bool ctrlOrCmd
{
get
{
return Input.GetKey(KeyCode.LeftControl) || Input.GetKey(KeyCode.RightControl)
|| Input.GetKey(KeyCode.LeftCommand) || Input.GetKey(KeyCode.RightCommand);
return ctrl || command;
}
}

Expand All @@ -104,7 +103,7 @@ public bool ctrlOrCmd
/// </summary>
public bool ctrl
{
get
get
{
return Input.GetKey(KeyCode.LeftControl) || Input.GetKey(KeyCode.RightControl);
}
Expand Down Expand Up @@ -139,7 +138,11 @@ public bool command
{
get
{
return Input.GetKey(KeyCode.LeftCommand) || Input.GetKey(KeyCode.RightCommand);
//In win, as long as the win key and other keys are pressed at the same time, the getKey will continue to return true. So it can only be shielded.
if (Application.platform == RuntimePlatform.OSXPlayer || Application.platform == RuntimePlatform.OSXEditor)
return Input.GetKey(KeyCode.LeftCommand) || Input.GetKey(KeyCode.RightCommand);
else
return false;
}
}
}
Expand Down

0 comments on commit b898318

Please sign in to comment.