I am trying to send python array between python program and Unity3D. Here is the python part to send a string message:
#send the message
import socket
UDP_IP = "127.0.0.1"
UDP_PORT = 5065
sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
msg = "Hello word!"
sock.sendto(msg, (UDP_IP, UDP_PORT))
#receive the message in Unity (C-sharp)
IPEndPoint anyIP = new IPEndPoint(IPAddress.Parse("0.0.0.0"), port);
byte[] data = client.Receive(ref anyIP);
string text = Encoding.UTF8.GetString(data);
I know that I can transform the numpy array to a string format and parse it to float in Unity. Is there any other elegant way to send and receive a numpy array instead of string?