Mac address ESP32 into unity C#

I have question to ask. currently my project is to measure the angle of IMU BNO055 which connected to M5 stack atom (ESP32). I used three IMU sensors and with using the ESP-NOW to transmit the data to M5 stack monitor. I used mac address of each M5 stack atom to get the data. My question is how can I read the data from mac address to Unity script

arduino code and unity

#include <M5Stack.h>
#include <WiFi.h>
#include <esp_now.h>
#define BNO055_SAMPLERATE_DELAY_MS (100)
uint8_t ad5;
float incomingqw;
float incomingqx;
float incomingqy;
float incomingqz;
// Structure example to receive data
// Must match the sender structure
typedef struct struct_message {
float w,x,y,z;
} struct_message;

float data[15];
File file;
const char* fname = "/data.csv";

// Create a struct_message called myData
struct_message BNO055Readings;
struct_message myData;

// callback function that will be executed when data is received
void OnDataRecv(const uint8_t * mac, const uint8_t *incomingData, int len) {
char macStr[18];
snprintf(macStr, sizeof(macStr), "%02X:%02X:%02X:%02X:%02X:%02X",
mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);
memcpy(&myData, incomingData, sizeof(myData));

data[0] = mac[5];
data[1] = myData.w;
data[2] = myData.x;
data[3] = myData.y;
data[4] = myData.z; 
using System;
using System.IO.Ports;
using System.Threading;
using UnityEngine;
public class ControlObjectByMPU9150InUnity : MonoBehaviour {
private const string SERIAL_PORT = "COM4";
private const int SERIAL_BAUD_RATE = 115200;
private const int SERIAL_TIMEOUT = 100;
private Thread _readThread;
private static SerialPort _serialPort;
private static bool _continue;

private static Quaternion _handQuaternion = new Quaternion();

void Start() {
    _readThread = new Thread(Read);
    _serialPort = new SerialPort(SERIAL_PORT, SERIAL_BAUD_RATE);
    _serialPort.ReadTimeout = SERIAL_TIMEOUT;
    _continue = true;

void Update() {
    transform.rotation = _handQuaternion;

void OnApplicationQuit() {
    _continue = false;

private static void Read() {
    string[] values;
    float x, y, z, w;
    while (_continue) {
        if (_serialPort.IsOpen) {
            try {
                values = _serialPort.ReadLine().Split('\t');
                if (values[0] == "quat") {
                    x = float.Parse(values[2]);
                    y = -float.Parse(values[4]);
                    z = float.Parse(values[3]);
                    w = float.Parse(values[1]);
                    _handQuaternion.Set(x, y, z, w);
            } catch (TimeoutException) {

@nur92, your topic has been moved to a more suitable location on the forum. Installation and Troubleshooting is not for problems with (or advise on) your project :wink: See About the Installation & Troubleshooting category.

Does that work? To my knowledge networking uses IP addresses, not MAC addresses.