I’ve got some kind of voxel based terrain where I want to send an array of “voxels” that were manipulated by a player to all the other players, so that their corresponding terrain can be updated, too. Additionally, I want to do that in a separate thread since I don’t want the main thread to be blocked during the network IO operations.
I think that this is very similar to Minecraft and as far as I know Minecraft is reading and writing to TCP connection streams in separate threads. How can I do this in Unity? Are the remote procedure calls called from separate threads? What about the Network View?
Best regards
BrightBit
If you have Pro you can use .NET sockets otherwise you can buy something from the UAS. If you Google for unity sockets or unity TCP you’ll find tons of articles, source code, etc. I assume that most of the work in .NET sockets is in a separate thread (networking usually is) but I’m not 100% sure. You could certainly put your code into a .NET thread as long as your own interface was thread safe. This is probably also true for the UAS socket libs, as long as they don’t make any Unity calls (which you are not allowed to make from threads).
Hi MakeCodeNow,
thanks for your answer. You can use .NET sockets with Unity basic, too. Anyway, I will investigate those TCP examples out there.
Thank you.
I would use something like Lidgren for your networking which uses UDP