docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Class NetworkManagerHelper

    Helper class to instantiate a NetworkManager This also provides the ability to: --- instantiate GameObjects with NetworkObject components that returns a Guid for accessing it later. --- add NetworkBehaviour components to the instantiated GameObjects --- spawn a NetworkObject using its parent GameObject's Guid Call StartNetworkManager in the constructor of your runtime unit test class. Call ShutdownNetworkManager in the destructor of your runtime unit test class.

    Includes a useful "BuffersMatch" method that allows you to compare two buffers (returns true if they match false if not)

    Inheritance
    object
    NetworkManagerHelper
    Inherited Members
    object.ToString()
    object.Equals(object)
    object.Equals(object, object)
    object.ReferenceEquals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    Namespace: Unity.Netcode.TestHelpers.Runtime
    Assembly: solution.dll
    Syntax
    public static class NetworkManagerHelper

    Fields

    Name Description
    CurrentNetworkManagerMode
    InstantiatedGameObjects
    InstantiatedNetworkObjects

    Properties

    Name Description
    NetworkManagerGameObject
    NetworkManagerObject

    Methods

    Name Description
    AddComponentToObject<T>(Guid)

    Helper class to add a component to the GameObject with a NetoworkObject component

    AddGameNetworkObject(string)

    Add a GameObject with a NetworkObject component

    BuffersMatch(int, long, byte[], byte[])
    ShutdownNetworkManager()
    SpawnNetworkObject(Guid)

    Spawn the NetworkObject, so Rpcs can flow

    StartNetworkManager(out NetworkManager, NetworkManagerOperatingMode, NetworkConfig)

    Called upon the RpcQueueTests being instantiated. This creates an instance of the NetworkManager to be used during unit tests. Currently, the best method to run unit tests is by starting in host mode as you can send messages to yourself (i.e. Host-Client to Host-Server and vice versa). As such, the default setting is to start in Host mode.

    In This Article
    Back to top
    Copyright © 2024 Unity Technologies — Trademarks and terms of use
    • Legal
    • Privacy Policy
    • Cookie Policy
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)