Unity Control Schemes – No Events Firing

I ran into a problem when working with the action map in my Unity game. I wanted to break the controls into their own separate schemes for rebinding, but there was a problem! When I added the control schemes, my code seemed to stop working. I checked the C# callback and Default Map on my PlayerInput component, toggling autoswitch didn't do anything, and I double-checked to make sure there were no other scripts consuming the input events.

After inspecting the InputAsset as JSON, I noticed something! The devices (although in the editor it says "All Devices") were empty!

"controlSchemes": [
    {
        "name": "Gamepad",
        "bindingGroup": "Gamepad",
        "devices": []
    },
    {
        "name": "Keyboard",
        "bindingGroup": "Keyboard",
        "devices": []
    },
    {
        "name": "GCC",
        "bindingGroup": "GCC",
        "devices": []
    }
]

Aha! I remembered a little tick box I didn't know the use of when creating the control schemes!
Image 1 Image 2

Here's what it looked like after I assigned them:

"controlSchemes": [
    {
        "name": "Gamepad",
        "bindingGroup": "Gamepad",
        "devices": [
            {
                "devicePath": "",
                "isOptional": false,
                "isOR": false
            }
        ]
    },
    {
        "name": "Keyboard",
        "bindingGroup": "Keyboard",
        "devices": [
            {
                "devicePath": "",
                "isOptional": false,
                "isOR": false
            }
        ]
    },
    {
        "name": "GCC",
        "bindingGroup": "GCC",
        "devices": [
            {
                "devicePath": "",
                "isOptional": false,
                "isOR": false
            }
        ]
    }
]

So remember to assign the device (although you already assigned the buttons in the action map) to the scheme!

CI/CD macOS Application Bundling .app Artifacts

CI/CD macOS Application Bundling .app Artifacts

1. macOS Application Bundle Structure

1.1 The .app Bundle Format

In macOS, applications are distributed as bundles, a directory structure that contains executable code and related resources. Here's the typical structure of a .app bundle:

MyApp.app/
  Contents/
    Info.plist
    MacOS/
      MyApp
    Resources/
      MyApp.icns
  • Info.plist: Metadata and configuration information.
  • MacOS/: Main executable file.
  • Resources/: Stores resource files, such as images and localized content.
1.2 Understanding the Info.plist File

A .app bundle is really just a directory. The Info.plist file is critical to the .app bundle as it is what defines how to use this folder as a launcher instead of a folder. It contains key-value pairs that macOS uses to index the application. Key elements include:

  • CFBundleExecutable: Specifies the main executable file.
  • CFBundleIconFile: Defines the icon file.

Here's an example snippet:

<dict>
    <key>CFBundleExecutable</key>
    <string>MyApp</string>
    <key>CFBundleIconFile</key>
    <string>MyApp.icns</string>
</dict>

2. ICNS Conversion

macOS uses the ICNS file format for icons. A convenient conversion tool is png-to-icns-right-click-converter. This tool allows for seamless conversion from PNG to ICNS, suitable for inclusion in the application bundle's Resources directory.

3. CI/CD Integration

3.1 YAML Configuration for Packaging macOS Application

Continuous Integration and Continuous Deployment (CI/CD) streamline the development workflow. Below is a YAML script that demonstrates how to package a macOS application binary:

pack_macos_app:
    stage: package_stage
    dependencies:
        - build_stage
    script:
        - INFO_PLIST="$APP_NAME.app/Contents/Info.plist"
        - echo "Packing self-contained build for macOS x64..."
        - mkdir -p $APP_NAME.app/Contents/MacOS
        - mkdir -p $APP_NAME.app/Contents/Resources
        - cp Resources/Icons/icon.icns $APP_NAME.app/Contents/Resources/
        - cp $BUILD_DIR/$BINARY_NAME $APP_NAME.app/Contents/MacOS/
        - chmod +x $APP_NAME.app/Contents/MacOS/$BINARY_NAME
        - echo '<?xml version="1.0" encoding="UTF-8"?>' > $INFO_PLIST
        - echo '<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">' >> $INFO_PLIST
        - echo '<plist version="1.0">' >> $INFO_PLIST
        - echo '<dict>' >> $INFO_PLIST
        - echo '    <key>CFBundleExecutable</key>' >> $INFO_PLIST
        - echo "    <string>$BINARY_NAME</string>" >> $INFO_PLIST
        - echo '    <key>CFBundleIconFile</key>' >> $INFO_PLIST
        - echo '    <string>icon.icns</string>' >> $INFO_PLIST
        - echo '</dict>' >> $INFO_PLIST
        - echo '</plist>' >> $INFO_PLIST
    artifacts:
        name: "macOS x64 (self-contained)"
        paths:
            - $BUILD_DIR/$APP_NAME.app
        expire_in: 1 week

TL;DR

macOS applications rely on a bundle structure, where an application is organized as a directory with the .app extension. This structure includes executable code, resources, and metadata, all defined within specific subdirectories and files such as .plist and ICNS icon files. Understanding these aspects allows developers to create CI/CD bundling stages for any macOS app.

Gaming in Thailand as a Foreigner

Hey gamers! It's world famous video gamer downthecrop! Back from my Thailand adventure and sharing the wisdom my globe trotting has afforded me!

General Internet Speed

This is going to depend mostly on your accommodation. I had 30/10 internet through Coax in my building which I'd estimate finished construction in the mid 2000's. You can find fiber internet in Bangkok but I'd assume most places are still Coax or DSL instead of fiber. Most internet is routed through Chang Mai anyway from the traceroutes I did while I was there.

Gaming VPN's

While there is a Thai server for League of Legends on Garena a problem you will experience in Thailand is that there just isn't a large enough population to support some games. League of Legends for example I was getting queue times exceeding 15 minutes at peak times (Noon to 11:00PM) in ranked which is extremely long compared to NA/EU/KR. To remedy this you are going to need to select the closest server with an active playerbase for your favorite games! I played mostly on Vietnam for League of Legends. Although you can simply change the region of the Garena Launcher and download any game you want there is IP based region lock for some games. League of Legends falls into these IP locked games. Because of this we are going to need to use a VPN.

Generally VPN's aren't very good for gaming. Due to oversold traffic and a lack of fast localized routers to handle your traffic you are going to be experiencing higher latency playing through a VPN than without one. There are a few VPN providers that SEA use to get their game on!

  • Mudfish
  • VietPN
  • PingBooster

Note: Exitlag and WTFast have very few servers in SEA so I wouldn't recommended them as a first choice for this use case but they will work.

For me I used VietPN and it cost me $5 a month which was a great price. Fast servers to Vietnam which is region locked for League of Legends. I would have preferred to play to China (Ionia probably the worst choice for server because it's so far away but there are many regions in China which are closer and would still have more players than TH or SG server which were the two best choices for ping.

Anyway I'm not spell checking this I just wanted to document for anyone else that is thinking of gaming in Thailand!

Nano for Windows (CMD and PowerShell)

Nano is my preferred editor for quick config changes. It's simple to install or even comes standard on many unix systems but what about Windows?

Install Chocolatey (Run as Administrator in PowerShell)

Set-ExecutionPolicy Bypass -Scope Process -Force; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))

Install Nano (Run as Administrator)

choco install nano

Now you can run nano to open the editor.

Blog Relaunch

Well well well. Look who’s back to writing a blog that no one will ever read or care about. That’s right! Lil’ Cropster.

As you can see I’ve gone and touched up some of the loading issues and improved the site a little. Goal is the same as it always was. Create more content and hopefully attract more eyeballs to look at it. A growing list of topics continue to overflow from my notes application and “like a bee thats gathered too much honey, needs hands out stretched to take it” or something, whatever Zarathustra said.

I spent some time last year writing a few posts for this which, after careful cringe analysis, seem to actually be good! Hopefully after I private all my posts and scrub this blog from the internet again in the coming months when I have some kind of internal crisis I will look at these posts during the 2020 relaunch with pride.