Question by
ankitpsaraogi · Jun 01, 2020 at 09:54 AM ·
unity 5networkingsocketstcptcpclient
I need simple scripts to send a message from one unity build to another build.
I need a simple code which would demonstrate sending a message, say "HI" to another unity exe build.
something of this sort:
---Application 1 at IP address 192.168.0.10:
void sendMessage()
{
string Message = "Hi";
//code to send message to 192.168.0.11 (ClientIP)
}
---Application 2 at IP address 192.168.0.11:
void Update()
{
//Check for messages
if (received)
{
OnReceiveMessage(message);
}
}
void OnReceiveMessage(string message)
{
string MessageReceived = message;
Debug.Log(message);
}
Comment
Your answer
Follow this Question
Related Questions
Unity is only printing first message from server 0 Answers
Can't recreate a match using UNET matchmaker 1 Answer
How to spawn projectiles on the server from a client. 0 Answers
Reference lost in NetworkEntity 0 Answers
What's wrong with my script ? 0 Answers