Skip to content

JohannesDeml/Unity-Net-Core-Networking-Sockets

Repository files navigation

Unity .Net Core Networking Client

Unity Editor Screenshot

Lightweight Unity client for NetCoreServer
openupm Unity 2018.1 or later

This is an example for a unity client that works with a NetCoreServer server application. The latest version is built with Unity 2020.3.1f1 and NetCoreServer 5.0.15.

Features

  • Supports SSL, TCP & UDP
  • Client code from NetCoreServer with wrappers for unity usage
  • Precompiled server executables for windows for easy testing
  • Small GC overhead - Usage of MemoryStream
  • Async send and receive - Does not block the Main Thread
  • Low level - just plain UPD/TCP/SSL
  • Tested with local, network and remote server
Platform SSL TCP UDP
Editor ✔️ ✔️ ✔️
Android ✔️ ✔️ ✔️
iOS ✔️ ✔️ ✔️
Windows ✔️ ✔️ ✔️

Installation

You can either install the package through the package manager with OpenUPM (Recommended) or download the scripts as a unity package

OpenUPM

# Install openupm-cli
$ npm install -g openupm-cli

# Enter your unity project folder
$ cd YOUR_UNITY_PROJECT_FOLDER

# Add package to your project
$ openupm openupm add com.deml.netcore-networking

Download

Latest Unity Package

Setup

  • Unity 2020.3.1f1 (Works with older versions as well)
  • Precompiled servers an in ServerWindows, run the bat you want to test
  • Open Samples/EchoClient/Scenes/NetworkExampleClient.unity and hit play.
  • Default port is 3333 when running the bat files.

Troubleshooting

  • I can't find the samples
    • The samples are stored in Assets/NetCoreNetworking/Samples~. A symlink at Assets/Samples points to the folder. That symlink might break when pulling for the first time on Windows. There are two solutions for it:
  • The precompiled server scripts don't work

TODO

  • Split messages back into the sent chunks
  • Fix bug: Repeated asnyc sending results in some packages not being sent for UDP
  • Support Websockets

Libraries

License