https://github.com/ycarowr/unitynetworkingapi
A Unity3D Networking API in C#
https://github.com/ycarowr/unitynetworkingapi
client client-server csharp csharp-network framework game-client game-server library network networking server server-plugin tcp udp unity unity-client unity-networking unity-server unity3d unity3d-plugin
Last synced: 5 months ago
JSON representation
A Unity3D Networking API in C#
- Host: GitHub
- URL: https://github.com/ycarowr/unitynetworkingapi
- Owner: ycarowr
- Created: 2020-03-21T22:42:31.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2021-04-17T11:54:40.000Z (almost 5 years ago)
- Last Synced: 2025-06-04T14:17:27.289Z (8 months ago)
- Topics: client, client-server, csharp, csharp-network, framework, game-client, game-server, library, network, networking, server, server-plugin, tcp, udp, unity, unity-client, unity-networking, unity-server, unity3d, unity3d-plugin
- Language: C#
- Homepage:
- Size: 676 KB
- Stars: 4
- Watchers: 2
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
[](https://unity3d.com/get-unity/download)
[](https://twitter.com/intent/follow?screen_name=ycarowr)
# Unity Networking API
The repository contains a solution for networking in Unity, it's made in pure C# without the usage of Unity's built-in HLAPI components.
Please consider that this is a project made for learning purposes, so there are limitations, bugs and a lot of room for further improvements and tests, feel free to mail me with suggestions about the architecture or anything else.
### Objetives
The main goal is to have two unitypackages, client and server, whitch will be starting points for future multiplayer prototypes. And also learn the basics of networking.
### Projects
Here are the code of both projects:
1. The [Client Project](/UnityNetworkingAPI/UnityGameClient).
2. The [Server Project](/UnityNetworkingAPI/UnityGameServer).
Here is the link to both [Unity Packages](/UnityNetworkingAPI/Versions).
### How to use it? And Demo Apps
Inside each package there are demo applications made to help with understanding the tool.
Currently in the demo you can:
1. Instantiate players;
2. Move players around and jump;
3. Send text messages Client <-> Server;
Note: all the messages are processed in the server side.
Here is an image of two demo players connected to the server:

Here are the content of the demo scenes:


### Creating the Server Application
The easiest way to create a server app is described below:
1. Download the Server UnityPackage and import it into your game server. Link [here](/UnityNetworkingAPI/UnityGameServer).
2. Create a new script and open it.
3. Add the following import on top: `using UnityGameServer;`
4. Change the parent class of the script to: `BaseServerApplication`
5. Drop the script into a gameObject inside the scene.
6. Drag and drop the scriptable object that contains the server configurations. The asset is located at: `UnityNetworkingAPI/UnityGameServer/Assets/UnityGameServer/ServerConfigs.asset`
It should look like this picture from the [DemoServerApp.cs](/UnityNetworkingAPI/UnityGameServer/Assets/UnityGameServer/Scripts/Demo/ServerApplication/DemoServerApplication.cs) :

7. Press Play and you should be able to see the following start up logs, which means the server is online in your local machine:

### Creating the Client Application
The client application has almost the same set of steps as the server:
1. Download the Client UnityPackage and import it into your game client. Link [here](/UnityNetworkingAPI/UnityGameClient).
2. Create a new script and open it.
3. Add the following import on top: `using UnityGameClient;`
4. Change the parent class of the script to: `BaseNetworkApplication`
5. Drop the script into a gameObject inside the scene.
6. Drag and drop the scriptable object that contains the client configurations. The asset is located at: `UnityNetworkingAPI/UnityGameClient/Assets/UnityGameClient/ClientConfigs.asset`
It should look like this picture from the [DemoClientApp.cs](/UnityNetworkingAPI/UnityGameClient/Assets/UnityGameClient/Scripts/Demo/Client/DemoClientApp.cs) :

7. Press Play and, if the server is online in your local machine, you should be able to see the following start up logs:

After both applications are connected a player will be instantiated and you will be able to move and using the keyboard WASD and Space.
Feel free to use the tool as you need :)
### References
I used [Tom Weiland](https://github.com/tom-weiland/tcp-udp-networking/) tutorial series as a base to start my work. Check out his videos to have complementary explanations about networking.