Legacy:NetMode

From Unreal Wiki, The Unreal Engine Documentation Site
Jump to navigation Jump to search

In replication, the NetMode property of the Level indicates what type of network game or standalone game is being played.

It is sometimes checked within functions or within the replication block when the code needs to behave slightly differently in a different network environment. It is most commonly used to differentiate whether an object with ROLE_Authority is in a botmatch/listen server or a dedicated server.

It will be different on clients and servers though other parts of the LevelInfo actor should be the same. The options are:

NM_Standalone 
a botmatch or single player game
NM_DedicatedServer 
a dedicated server
NM_ListenServer 
a non-dedicated server (ie the Host Multiplayer Game in the menu)
NM_Client 
a network client

<uscript> simulated event Tick (float DeltaTime) {

 if ( Level.NetMode != NM_DedicatedServer ) {
   // Code here will only be executed on Listen servers and game clients.
 }
 if ( Level.NetMode == NM_DedicatedServer ) {
   // Code here will only be executed on a server.
 }

} </uscript>

Related Topics