Skip to content

Latest commit

 

History

History
56 lines (35 loc) · 1.78 KB

File metadata and controls

56 lines (35 loc) · 1.78 KB

Unity-iOS-KeyboardAndMouse-Example

A demo project based on the Unity FPS Microgame template that demonstrates how to add full keyboard and mouse support to Unity iOS games. This improves the gameplay experience when running iOS games on Macs or on iPads with an external keyboard.

Requirements

This demo project is made with Unity 6.3.

The keyboard-and-mouse feature requires:

  • iOS 14 or later
  • Input System package

Quick Start

All implementation files are located in the iOSInput folder.

To integrate the feature into your own project:

  1. Copy the iOSInput folder into your project.

  2. Call iOSInput.Initialize() programmatically, or attach the iOSInput component to your initial scene.

  3. Replace all references to Cursor with iOSCursor.

    #if UNITY_IOS && !UNITY_EDITOR
    using UnityEngine.InputSystem.iOS.Extensions;
    #endif
    
    //...
    
    #if UNITY_IOS && !UNITY_EDITOR
        iOSCursor.lockState = CursorLockMode.Locked;
        iOSCursor.visible = false;
    #else
        Cursor.lockState = CursorLockMode.Locked;
        Cursor.visible = false;
    #endif

Testing the Demo IPA

You can install the IPA on your iOS devices or macs using sideloading tools.

Note: If you’re running the app on iOS, you may need to disable AssistiveTouch; otherwise, the left mouse button may not work.

Note: If you’re using PlayCover on macOS, you may need to disable Keymapping in PlayCover settings; otherwise, you won’t be able to hide the mouse pointer.

License

FPS Microgame Template

All assets excluding the iOSInput folder are governed by the Unity Asset Store EULA. For more details, see FPSGame/Assets/FPS/Third-PartyNotice.txt.

iOSInput

The contents of the iOSInput folder are licensed under the Apache License 2.0.