Variable Input Device System

Working on a friend's project to create a system that supports mapping various unique input devices to characters in a smash-style fighter.

08 Nov 2025

Input Device Manager

Recently, a friend of mine posed an idea for a game they’re developing for a local game dev showcase: a platform fighter where each selectable character is associated with a unique controller. For this project, I needed to create a system that could handle inputs from multiple unique controllers to play as different characters, including character selection and pairing input devices to controller types.

The controllers used in the project are N64, GameCube, WiiMote and DK Bongos. These devices posed a notable issue, since three of the four use the same hardware to interface with the PC, meaning they are read as the same controller type. Since we couldn’t tell the difference between individual pieces of hardware, creative solutions had to be made to associate controllers with their type.

Gameplay

As a platform fighter, the fundamental gameplay revolves around choosing a character using their associated input device, having your opponent do the same, and then using a range of attacks and special moves to damage your opponent. The gameplay is inspired by games like Super Smash Brothers, so the health is a percentage that increases with each hit, ranging from 0% (undamaged) up, with the amount of knock back the enemy takes exponentially growing along side their health. When a player is finally knocked out of bounds, they lose a stock, and when they have no stocks left, they have lost the fight.

When developing this system, I had to consider its purpose in the game, specifically that not all devices will control a character in a fight (with only one-on-one battles planned for release), and that the type of device determined the character’s sprites and moves.

Overview

This system comes in three parts, the InputMapHandler, CharacterControllers, and PlayableCharacters. Each of these parts controls a different aspect of binding unique controllers to characters. Because part of this system was developed to be independent to the game itself, specifically the InputMapHandler, generic types were used to have it fit into projects outside of this specific game.

Input Map Handler

The Input Map Handler is the beating heart of this system, it creates input maps from Unity’s InputSystem for each device connected to the user’s PC, from keyboards to controllers; the system pairs created input maps with each device, setting it as the only input device read by that map. Using this, individual devices can be enabled, disabled, or read from, allowing for a range of different devices to be plugged in and read from at will.

The Input Map Handler is generically typed, allowing a system to create one with any type created by an input map asset. In Unity’s Input System, assets can generate a C# class so input maps can better interface with C# code. The class generated by the asset will always inherit from IInputActionCollection2, which we can use in our generic type class to specify that the type used in arguments should be generated from one of these assets. // insert declaration of InputMapHandler

Character Controller

Playable Character