C# Client 0.0.0.7
C# Library to interface with Corelink
|
This is a C# library modeled after <corelink-client-repo>/javascript/corelink.lib.js
that is designed to work with Unity. The code is borrowed and adapted from the previous example found in examples/unity
written by Connor and Zhenyi, but redesigned to allow for more generic use cases
The library files are located in CoreLink
. These serve as the library functions and the back end. The function definitions are modelled after the Node JS library. There is another folder located in CorelinkMonobehavior
which will contain scripts that you can attach to GameObjects. The files in this folder will be directly used by users. Users should create custom scripts that inherit from MB_ReceiverStream.cs
and MB_SenderStream.cs
and attach those to their game objects. Users should also create a custom class called ControlCallbacks that inherits from CorelinkWebsocket that will run custom functions when the server updates (ie, a new receiver, a new sender, a stream goes stale).
See examples/unity/MinimalBoilerplate
for stupidly simple demo code. examples/unity/MultiplayerSandbox
has a functional 2 person game
CoreLink
, CorelinkMonobehavior
, and SimpleJSON
from examples/csharp
into your Unity project's Asset/Scripts
folderCorelinkMonobehavior/CorelinkControl.cs
as a componentMB_SenderStream.cs
. Create a stream and use control.Send(streamid, data)
MB_ReceiverStream.cs
. Create a stream, specify the types and workspace, and create a custom overriden GetMessage() callbackControlCallbacks.cs
file. You can comment out all function declarations if you want to use the standard ones, but the class must exist in the project.This will create an html
folder inside clients/csharp
that you can copy and serve
Hooray it's easy!