The Wireless Communication Library adds Bluetooth, Wi-Fi, and Serial communication to Unity games. Control Wii Remotes, connect IoT devices, or build multiplayer experiences using Mono or IL2CPP. The framework handles pairing, data parsing, and hardware access so you can focus on gameplay.
Unity is a popular cross-platform game engine used to develop 2D, 3D, VR, and AR games and applications. It provides a user-friendly interface, a powerful physics engine, and a vast asset store, making it a top choice for indie developers and large studios alike. Unity supports multiple platforms, including PC, mobile, consoles, and web, allowing developers to create games for a wide audience.
Wireless Communication Library Unity examples ara available on GitHub.
Unity and Bluetooth
Bluetooth support in Unity enables developers to connect external devices, such as game controllers, sensors, and input peripherals, to enhance gameplay. This is especially useful for:
- Games — supporting Bluetooth controllers for better precision.
- VR and AR experiences — connecting motion trackers and wearable devices.
- Custom input devices — using unique controllers like the Wii Remote for innovative gameplay mechanics.
The Bluetooth Framework provides an easy way to add Bluetooth support into your Unity games.
The standard WinRT Bluetooth APIs and System.Device.Bluetooth are not a solution for Unity: they work in the editor but
fail at runtime with the IL2CPP scripting backend, which is the default on most platforms and is mandatory on iOS. The
Bluetooth Framework avoids the problem by talking to the operating system's Bluetooth APIs directly,
and it supports both Mono and IL2CPP.
Read more about Bluetooth communication in Unity →
Making Unity games more interesting with Wii Remote
The Wii Remote (or Wiimote) is a motion-sensing controller that can be integrated into Unity games via Bluetooth, offering unique interaction possibilities:
- Motion controls — players can swing, tilt, or point the Wiimote to control in-game actions.
- IR pointer — the Wii Remote's infrared sensor can be used for aiming or cursor-based interactions.
- Vibration feedback — enhancing immersion with haptic feedback.
By using the Bluetooth Framework library, developers can read Wiimote inputs in Unity, allowing for creative game mechanics — such as sword-fighting games, sports simulations, or interactive art installations. See Wii Remote and Bluetooth Framework for the full article.
Wi-Fi communication in Unity
Beyond Bluetooth, Unity can also leverage Wi-Fi and Serial communication to connect with external hardware, IoT devices, or even other computers for multiplayer or hybrid gameplay experiences.
Wi-Fi allows Unity games to communicate over a network, enabling features like:
- Multiplayer gaming — real-time online gameplay using Unity's Netcode or third-party solutions.
- IoT and smart device integration — controlling lights, drones, or robots from within a Unity game.
- Remote data streaming — sending sensor data (for example, from a Raspberry Pi or Arduino) to Unity for visualization.
Developers can easily use the Wi-Fi Framework to find available Wi-Fi networks, configure Wi-Fi hardware, and connect to a required access point. The Wi-Fi Direct features supported by the Wi-Fi Framework allow communication with Wi-Fi Direct devices without the need for an access point. Once a Wi-Fi connection is established, developers can use TCP/IP or UDP sockets or REST APIs to exchange data between Unity and external systems.
Serial communication in Unity
For direct hardware interaction, serial communication is useful when working with microcontrollers (Arduino, ESP32), sensors, or custom input devices. Key applications include:
- Arduino integration — reading sensor data (temperature, motion, buttons) into Unity for interactive installations.
- Custom controllers — building unique game controllers using microcontrollers and serial communication.
- Industrial and educational simulations — connecting Unity to real-world machinery or robotics for training simulations.
Unity does not natively support serial communication, but developers can use the Serial Framework to add serial communication support.
The standard System.IO.Ports namespace is not a solution for Unity: it works in the editor but fails at runtime with the
IL2CPP scripting backend, which is the default on most platforms and is mandatory on iOS. The
Serial Framework avoids the problem by talking to the operating system's serial APIs directly, and it
supports both Mono and IL2CPP. Read more about serial communication in Unity →
Unity's scripting backends
Unity offers two primary scripting backends to compile and execute your C# code: Mono and IL2CPP. These backends serve as the bridge between your high-level C# scripts and the native machine code that runs on various platforms. Choosing the right backend significantly impacts your game's performance, compatibility, and development workflow.
Mono has been Unity's default scripting backend for many years, based on the open-source Mono project. It uses a Just-In-Time (JIT) compilation approach. Introduced in Unity 4.5, IL2CPP (Intermediate Language to C++) is now the default and recommended backend for most platforms.
The Wireless Communication Library supports both Unity backends. For the Mono backend, simply add the framework's assembly to your Unity project; the JIT compiler uses the assembly as shipped. For the IL2CPP backend, the current release of the frameworks no longer requires the source-code edition. The precompiled assemblies can be added directly to the Unity project and compiled into the IL2CPP player; the P/Invoke bindings that the frameworks use to reach the operating system are preserved through IL2CPP, and the native dependencies that the frameworks require are packaged with them. Older releases did require the source-code edition, but that limitation has been removed.
Frequently asked questions
- Can I use the Wireless Communication Library with Unity?
- Yes, WCL supports Unity via its .NET assemblies. You can add Bluetooth, Wi-Fi, and Serial communication to your game using Mono or IL2CPP scripting backends.
- How to integrate the Wii Remote with Unity?
- Use the Bluetooth Framework to connect and read Wii Remote inputs (motion, IR pointer, vibration). The library handles pairing and data parsing.
- Does WCL work with IL2CPP?
- Yes. The current release no longer requires the source-code edition. The precompiled assemblies can be added to a Unity project and compiled into the player with either the Mono or the IL2CPP scripting backend.