Skip to content
This repository has been archived by the owner on Aug 15, 2022. It is now read-only.

Network Instantiation Flush

Effestiar edited this page Nov 21, 2018 · 13 revisions

After creating or joining a server it is necessary to call NetworkObject.Flush on the related NetWorker. This is to notify Forge that unity is ready and it is possible to spawn NetworkBehaviors into the scene.

The function gets automatically called by the NetworkManager when you switch scenes if "Automatic Scenes" is ticked on said NetworkManager. (This is also what happens during the default MultiplayerMenu).

Server Example:

        int maxAllowedClients = 32;
        UDPServer server = new UDPServer(maxAllowedClients);
        server.Connect(port:8888);
        NetworkManager.Instance.Initialize(server);
        NetworkObject.Flush(server);

Client Example:

    public void OnAccepted(NetWorker sender)
    {
        NetworkObject.Flush(sender);
    }

Home

Getting Started
Network Contract Wizard (NCW)
Network Object
Remote Procedure Calls (RPCs)
Unity Integration
Basic Network Samples
Scene Navigation
NetWorker
Master Server
Web Server
Netcoding Design Patterns
Troubleshooting
Miscellaneous
Forge Networking Alloy
Steamworks
Clone this wiki locally