Skip to content

Releases: bentalebahmed/BlueUnity

BlueUnity-Kotline-v0.0.1

10 Dec 23:08

Choose a tag to compare

New in the Kotlin Version

This Kotlin-based rewrite introduces major improvements over the previous Java implementation.


New Feature: Device-to-Device Communication

BlueUnity now supports direct Bluetooth Classic communication between two Android devices.

  • One Android device can act as the server (discoverable mode)
  • Other Android device can connect as the client

This capability did not exist in the Java version, which only supported device-to-module connections (ESP32, HC-05/06, BM78…).


New Feature: JavaProxy-Based Callback System

The Java version relied on Unity’s SendMessage, which required GameObject lookups and string-based messaging.

The Kotlin version introduces a JavaProxy callback API.

Available Callbacks

  • onDiscoveryStarted()
  • onDiscoveryDeviceFound(name, address)
  • onDiscoveryFinished()
  • onConnecting(address)
  • onConnected(address)
  • onDisconnected(address)
  • onDataReceived(data)
  • onDataNotSent(data)
  • onError(error)

Kotlin ByteArray → Unity byte[] Conversion

Kotlin uses signed bytes (Byte, -128 to 127), while Unity uses unsigned bytes (byte, 0 to 255).

In this new version:

  • All data received from Android arrives as signed ByteArray
  • A conversion is automatically handled on the Unity side