- Home /
Unity editor and build crash when using NetworkComms.net functions
Hello all,
I have downloaded and build the NetworkComms net DLL from here NetworkComms.net
I have the following tiny script:
public void requestLogin()
{
//var connection = new ConnectionInfo("127.0.0.1", 5599);
string test = "This is a test string";
NetworkComms.SendObject("Message", "127.0.0.1", 4598, test);
}
When I call that function from a button click, the editor freezes. If i debug the editor, I end up getting exactly one unhandled access violation from KernalBase.dll
and then seemingly infinite access violations from mono.dll
. Inevitably, the editor crashes. The result is the same with a built version on the game.
I am using unity 5.4.0f3 with VS2015. I compiled NetworkComms.net in "any cpu".
Any thoughts? This is a deal-breaker for me. I'll be heading over to unreal if I can't get any serious networking out of unity. Thanks!
Answer by WazzaM · Aug 31, 2016 at 07:25 AM
Hey you can definitely send a message between instances of unity games. Unity have their own UDP based protocol that is a low level transport and then built on top a high level API for networked multiplayer.
Checkout the scripting reference docs for UnityEngine.Networking classes for NetworkTransport. Might be a typo in that - I'm answering your question in bed on my phone...
Anyway i think your example is trying to send and receive on the same machine from the same process in a tight loop until the operating system intervenes to rescue itself. Bit harsh to blame Unity for that.
When sending between two processes with UDP on localhost (127.0.0.1) you really need to have different source and destination ports to differentiate the two parties. TCP kind of forces the port difference by comparison but is bad for game events.
Anyway check out unity's NetworkTransport class that's part of the low-level API. Or write your own .NET sockets based message passing. I've done both and made both work.
Your answer
Follow this Question
Related Questions
Unity crashing efter losing connection to other Unity 0 Answers
Unity Editor Crash !!! 0 Answers
Run ObjectiveC or Java plugin in editor windows 0 Answers
Unity3d Apache Thrift Server 1 Answer
Editor crash on toggle with AA 2 Answers