Skip to main content

Unity Server

FigNet can also run as a server embedded directly inside a Unity project.

image

Import FigNetCore.package in your project. Go to Player Settings and set Api Compatibility Level to NET 4.x.

Open FigNetSampleScene and press the play button.

note
  • ServerManager.cs: starts an IServerSocket instance based on the ServerConfig.xml file
  • ClientManager.cs: starts an IClientSocket instance based on ServerConfig_Client.xml
  • Bootstrap.cs: registers the EchoHandler
important

When you have a Unity embedded server, use different OpCodes for Server and Client handlers, since FN.HandlerCollection is shared between Server and Client handlers, to keep down overall complexity.