category: Plugins

The Stormancer behaviours for unity3D are simple yet powerful scripts designed to be easy to use and highly customizable.

They will help you create your multiplayer application faster than you ever did when using stormancer.

Initialization

The behaviours introduce a new way to use stormancer in Unity3D.

The client is now located in a ClientProvider singleton existing outside the Unity scene logic, so it won't be deleted when loading a new scene.

In order to configure it, you will put a ClientBehaviour on a GameObject and fill its AccountId and ApplicationName in the editor.

enter image description here

Creating a stormancer scene

To connect to a scene, you can now put a RemoteScene in your scene.

enter image description here

The sceneId represents the scene name as you set it using the web api.

If you disable ConnectOnLoad, you'll have to use the public method ConnectScene() to connect your scene.

DisconnectOnUnload can be disabled to let your remotescene survive a load. It can be usefull if your scene is related to several Unity scenes. Be careful though, as the gameobject will survive, every other scripts attached to it will survive too.

So, if you have several Remote Scene to connect to, create several Gameobject and place only one remoteScene per GameObject.

Connected is just a way to show you wheter your scene is connected or not.

Remote Logic

Here comes the part where you'll be able to customize your scenes.

When creating a logic to apply to your scene, you must create a class that inherits from RemoteLogicBase.

public abstract class RemoteLogicBase : MonoBehaviour
{
    public RemoteScene RemoteScene;
    private long Clock

    public abstract void Init(Scene s);
    public abstract void OnConnected();
}

Every script inheriting from RemmoteLogicBase will register on the RemoteScene.

The init method will be called when the remote will have retreived the corresponding stormancer scene. You can create all routes and procedure you need in this method.

Onconnected will be called once the remote have finished connecting to the stormancerScene.

If you want to see an exemple of remoteLogic, look at the Replicator Plugin.