Skip to content

MirrorNG Migration Guide

uwee edited this page Feb 19, 2021 · 3 revisions

This is a WIP guide to assist in moving from Mirror to MirrorNG. It is not a step by step guide but instead a quick reference of the major and common changes that will need to be made when moving an existing project over.

High Level Concepts: -Many roles that NetworkManager fulfilled were split into other classes like NetworkClient, NetworkServer and NetworkSceneManager.
-Life cycle management is no longer based on overrides. Instead there are many UnityEvents that can be hooked without direct coupling.
-NetworkServer and NetworkClient are now Unity Components and are non static with no static fields accessible.
-The timing of OnEnable is not the same and may lead to NRE to NetworkServer/NetworkClient (#330).

Decorator Changes:
[Command] = [ServerRpc]
[TargetRpc] = [ClientRpc(target = Mirror.Client enum)]
[ServerCallback] = [Server(error = false)]

Renames:

ClientScene.localPlayer = NetworkClient.LocalPlayer
ClientScene.ready = NetworkClient.Connection.IsReady
NetworkIdentity.assetId = NetworkIdentity.AssetId
NetworkIdentity.netId = NetworkIdentity.NetId
NetworkIdentity.connectionToClient = NetworkIdentity.ConnectionToClient
NetworkBehaviour.isServer = NetworkBehaviour.IsServer
NetworkBehaviour.connectionToClient = NetworkBehaviour.ConnectionToClient
NetworkBehaviour.connectionToServer = NetworkBehaviour.ConnectionToServer
NetworkBehaviour.hasAuthority = NetworkBehaviour.HasAuthority
NetworkBehaviour.netId = NetworkBehaviour.NetId
NetworkBehaviour.isClientOnly = NetworkBehaviour.IsClientOnly
NetworkBehaviour.islocalPlayer = NetworkBehaviour.IsLocalPlayer
NetworkConnection.isReady = NetworkConnection.IsReady
NetworkConnection.identity = NetworkConnection.Identity
NetworkServer.active = NetworkServer.Active
NetworkServer.localConnection = NetworkServer.LocalConnection
NetworkClient.connection = NetworkClient.Connection

How to quickly add a NetworkManager:
Right Click Heirarchy > Network > NetworkManager

Example scenes can be added via Package Manager

Clone this wiki locally