02-05-2021



WebsocketSets

One of the first things I had to do, was figuring out how to connect to an external server via Unity client using a TCP/IP socket. It took a lot of searching to find help on this issue but I did find it eventually. I’ve added links to my files here so you can view/use them.

Unity Socket Server A socket server implementation for unity. Can be used with very few lines of code. Basically, can be used to allow clients to connects and send tokens. Unity is a ring gambled at the medium price of 50 Blood Shards. Ability to obtain crit damage and socket on top of these) it is acceptable for one party member to wear the ring, which ignores the legendary effect. If you have a well rolled Unity. Unity and socket.io (server) This is an implementation of the js/node rock paper scissor example with a Unity client. There is a WebGL build in the client sub folder but the project should work both on browser and as a standalone executable. The client's source is. IWebSocket interface for targeting the various platforms Unity supports. WebSocketMono utilizes WebSocket-Sharp. and should work on all mono platforms including the Unity Editor on Mac and PC. WebSocketUWP utilizes MessageWebSocket for Windows 10 (UWP) apps. Unity is a first-of-its-kind sleeveless vacuum system that pulls the vacuum in the socket using the energy created by the natural motion of the prosthetic foot. Designed to accommodate all prosthetic users, the benefits of this are a lighter, quieter, simpler vacuum suspension than any other vacuum technology on the market.

Socket

So to get your Unity application to connect to an external server via TCP/IP socket, you will need the following:

TCPConnection.cs – the connection handler, server communications
socketScript.cs – the script attached to one of the GameObjects in Unity (I used the Main Camera). We will use this script to attach a copy of TCPConnection.cs to the Camera as well.

Unity

Unity Socket Exception

I’ve added comments to the important things, hopefully they make sense.
If you want to use javascript instead of C# for your socketScript and application in general, remember to move the TCPConnection.cs into the /Assets/Standard Assets folder (just create it if it doesn’t exist) for it to work. In my case (since I used C#, I just put them both in the /Assets/Scripts folder).

I wrote my own very basic C++ windows socket server to test this. When interacting with server, make sure that your server returns the newline command after every response, otherwise your unity client will be left to hang (until the server disconnects). For our server we had to use n but it depends on what type of server you are running.

Socket

If you want to have multiple connections (like for most games, you’ll have the login server and the game/world server), you just got to add another instance of TCPConnection.cs to your socketScript.

Unity Socket Sets

Moving notice:
I wasn’t gonna bring over both posts separately, so this already includes the updates for multiple messages at once and using the split method to separate them. Also I’m now hosting these files here on this actual server instead of my synamicdsolutions URL.