MultiConnectMultiConnectDocs Website home
MultiConnectSDK › Export to .NET

3. Write scripts that work on both

Unity's classes come from UnityEngine, and on .NET the matching ones come from MultiConnect.MultiConnectEngine. A small block at the top of a script chooses the right one, because Unity defines UNITY_5_3_OR_NEWER and .NET does not.

Script 3.1: SpawnPoint.cs

#if UNITY_5_3_OR_NEWER
using UnityEngine;
#else
using MultiConnect.MultiConnectEngine;
using MultiConnect.Shared;
#endif

public class SpawnPoint : MonoBehaviour
{
    // Exported with the prefab, and restored on the server.
    public int team = 1;
    public float respawnSeconds = 5f;

    void Start()
    {
        Debug.Log("Spawn point for team " + team + " at " + transform.position);
    }
}

Your rooms from the Developer Guide work the same way, because IRoom and MatchMaking are the same in both.