Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Bug IPA(iOS platform) is installed on MBP(2020, Apple M1, 8G),Some Problems with Keyboard Input !!!

Discussion in 'iOS and tvOS' started by MingKKK, Jan 26, 2021.

  1. MingKKK

    MingKKK

    Joined:
    Apr 13, 2019
    Posts:
    15
    I packaged a project on the Mac platform and exported the IPA file. IPA is available on the latest Mac Book Pro with Apple M1 CPU. I want to install IPA on my MBP for testing.(My project is a game.)
    After the installation of the application(ipa) to get the system info is iOS platform and iPad device. Maybe the platform I chose to package ipa was iOS, but I don't kown why it's the "iPad" and not the "Mac Book Pro" that gets the device info.
    In C# code, I directly use the GPU name(Apple M1) given by the system info to determine whether to add keyboard mapping logic.
    I use the UnityEngine API: Input.GetKey、Input.GetKeyDown. But there is something wrong with the logic of the keyboard's keystroke response and I'm not sure if there's something wrong with the UnityEngine code.
    Error:
    1、Cannot respond to multiple keyboard keys at the same time.
    2、API Input.GetKey return valuse is not quite right. When my keyboard keys are raised, Input.GetKey will return true for a short period of time, and then false. Failure to respond to keyboard events in a timely manner


    Can someone help me!!!!!! THX very much!!!!
     
    LohQ likes this.
  2. Petras-Unity

    Petras-Unity

    Unity Technologies

    Joined:
    Oct 7, 2020
    Posts:
    25
    Using GPU name is so far the only way in Unity to check if the app is running on Mac. Even though iOS apps run on M1 Macs natively they are put inside a sandbox that emulates some things so the app could run without any changes done to iOS source.

    Regarding Input issues, my guess is that M1 converts physical keyboard key presses to "touch presses" like in iOS.
    In iOS concept of holding keyboard button is non-existent (if you hold it extra character options will appear).
    So thinking in a way of how iOS keyboard works, it registers input only when you release the button, there is an animation making button look like it's pressed in, after a moment there keyboard button animates back to default ("unpressed") appearance.
    M1 makes your physical keyboard act like iOS keyboard and that gives this weird behavior.

    For app to work correctly on M1 I would suggest building for Standalone (Mac).
     
    LohQ likes this.
  3. MingKKK

    MingKKK

    Joined:
    Apr 13, 2019
    Posts:
    15
    Thanks for response! Our team is trying to see if we can build a Mac packages. But I still hope Unity can support this feature(keyboard input) in the future.
     
  4. Petras-Unity

    Petras-Unity

    Unity Technologies

    Joined:
    Oct 7, 2020
    Posts:
    25
    Hey @MingKKK, excited to let you know that we started looking into this issue, you will be able to follow the progress on the resolution in issue tracker.