C# Class UnityEngine.Network

The network class is at the heart of the network implementation and provides the core functions.

Show file Open project: CarlosHBC/UnityDecompiled Class Usage Examples

Private Properties

Property Type Description
Connect NetworkConnectionError
Connect NetworkConnectionError
Connect NetworkConnectionError
Disconnect void
Disconnect void
HavePublicAddress bool
INTERNAL_CALL_CloseConnection void
INTERNAL_CALL_Destroy void
INTERNAL_CALL_DestroyPlayerObjects void
INTERNAL_CALL_GetAveragePing int
INTERNAL_CALL_GetLastPing int
INTERNAL_CALL_Instantiate UnityEngine.Object
INTERNAL_CALL_Internal_RemoveRPCs void
INTERNAL_CALL_Internal_SetSendingSpecific void
INTERNAL_CALL_SetReceivingEnabled void
InitializeSecurity void
InitializeServer NetworkConnectionError
InitializeServer NetworkConnectionError
Instantiate UnityEngine.Object
Internal_AllocateViewID void
Internal_ConnectToGuid NetworkConnectionError
Internal_ConnectToIPs NetworkConnectionError
Internal_ConnectToIPs NetworkConnectionError
Internal_ConnectToSingleIP NetworkConnectionError
Internal_ConnectToSingleIP NetworkConnectionError
Internal_GetPlayer int
Internal_GetTime void
Internal_InitializeServerDeprecated NetworkConnectionError
Internal_RemoveRPCs void
Internal_SetSendingGlobal void
Internal_SetSendingSpecific void
SetLevelPrefix void
TestConnection ConnectionTesterStatus
TestConnection ConnectionTesterStatus
TestConnectionNAT ConnectionTesterStatus
TestConnectionNAT ConnectionTesterStatus

Public Methods

Method Description
AllocateViewID ( ) : NetworkViewID

Query for the next available network view ID number and allocate it (reserve).

CloseConnection ( NetworkPlayer target, bool sendDisconnectionNotification ) : void

Close the connection to another system.

Connect ( HostData hostData, [ password ) : NetworkConnectionError

Connect to the host represented by a HostData structure returned by the Master Server.

Connect ( string GUID, [ password ) : NetworkConnectionError

Connect to a server GUID. NAT punchthrough can only be performed this way.

Connect ( string IP, int remotePort, [ password ) : NetworkConnectionError

Connect to the specified host (ip or domain name) and server port.

Destroy ( GameObject gameObject ) : void

Destroy the object across the network.

Destroy ( NetworkViewID viewID ) : void

Destroy the object associated with this view ID across the network.

DestroyPlayerObjects ( NetworkPlayer playerID ) : void

Destroy all the objects based on view IDs belonging to this player.

GetAveragePing ( NetworkPlayer player ) : int

The last average ping time to the given player in milliseconds.

GetLastPing ( NetworkPlayer player ) : int

The last ping time to the given player in milliseconds.

RemoveRPCs ( NetworkPlayer playerID ) : void

Remove all RPC functions which belong to this player ID.

RemoveRPCs ( NetworkPlayer playerID, int group ) : void

Remove all RPC functions which belong to this player ID and were sent based on the given group.

RemoveRPCs ( NetworkViewID viewID ) : void

Remove the RPC function calls accociated with this view ID number.

RemoveRPCsInGroup ( int group ) : void

Remove all RPC functions which belong to given group number.

SetReceivingEnabled ( NetworkPlayer player, int group, bool enabled ) : void

Enable or disables the reception of messages in a specific group number from a specific player.

SetSendingEnabled ( NetworkPlayer player, int group, bool enabled ) : void

Enable or disable transmission of messages and RPC calls based on target network player as well as the network group.

SetSendingEnabled ( int group, bool enabled ) : void

Enables or disables transmission of messages and RPC calls on a specific network group number.

Private Methods

Method Description
Connect ( HostData hostData ) : NetworkConnectionError
Connect ( string GUID ) : NetworkConnectionError
Connect ( string IP, int remotePort ) : NetworkConnectionError
Disconnect ( ) : void
Disconnect ( [ timeout ) : void
HavePublicAddress ( ) : bool
INTERNAL_CALL_CloseConnection ( NetworkPlayer &target, bool sendDisconnectionNotification ) : void
INTERNAL_CALL_Destroy ( NetworkViewID &viewID ) : void
INTERNAL_CALL_DestroyPlayerObjects ( NetworkPlayer &playerID ) : void
INTERNAL_CALL_GetAveragePing ( NetworkPlayer &player ) : int
INTERNAL_CALL_GetLastPing ( NetworkPlayer &player ) : int
INTERNAL_CALL_Instantiate ( UnityEngine prefab, Vector3 &position, Quaternion &rotation, int group ) : UnityEngine.Object
INTERNAL_CALL_Internal_RemoveRPCs ( NetworkPlayer &playerID, NetworkViewID &viewID, uint channelMask ) : void
INTERNAL_CALL_Internal_SetSendingSpecific ( NetworkPlayer &player, int group, bool enabled ) : void
INTERNAL_CALL_SetReceivingEnabled ( NetworkPlayer &player, int group, bool enabled ) : void
InitializeSecurity ( ) : void
InitializeServer ( int connections, int listenPort ) : NetworkConnectionError
InitializeServer ( int connections, int listenPort, bool useNat ) : NetworkConnectionError
Instantiate ( UnityEngine prefab, Vector3 position, Quaternion rotation, int group ) : UnityEngine.Object
Internal_AllocateViewID ( NetworkViewID &viewID ) : void
Internal_ConnectToGuid ( string guid, string password ) : NetworkConnectionError
Internal_ConnectToIPs ( string IP, int remotePort, int localPort ) : NetworkConnectionError
Internal_ConnectToIPs ( string IP, int remotePort, int localPort, [ password ) : NetworkConnectionError
Internal_ConnectToSingleIP ( string IP, int remotePort, int localPort ) : NetworkConnectionError
Internal_ConnectToSingleIP ( string IP, int remotePort, int localPort, [ password ) : NetworkConnectionError
Internal_GetPlayer ( ) : int
Internal_GetTime ( double &t ) : void
Internal_InitializeServerDeprecated ( int connections, int listenPort ) : NetworkConnectionError
Internal_RemoveRPCs ( NetworkPlayer playerID, NetworkViewID viewID, uint channelMask ) : void
Internal_SetSendingGlobal ( int group, bool enabled ) : void
Internal_SetSendingSpecific ( NetworkPlayer player, int group, bool enabled ) : void
SetLevelPrefix ( int prefix ) : void
TestConnection ( ) : ConnectionTesterStatus
TestConnection ( [ forceTest ) : ConnectionTesterStatus
TestConnectionNAT ( ) : ConnectionTesterStatus
TestConnectionNAT ( [ forceTest ) : ConnectionTesterStatus

Method Details

AllocateViewID() public static method

Query for the next available network view ID number and allocate it (reserve).

public static AllocateViewID ( ) : NetworkViewID
return NetworkViewID

CloseConnection() public static method

Close the connection to another system.

public static CloseConnection ( NetworkPlayer target, bool sendDisconnectionNotification ) : void
target NetworkPlayer
sendDisconnectionNotification bool
return void

Connect() public static method

Connect to the host represented by a HostData structure returned by the Master Server.

public static Connect ( HostData hostData, [ password ) : NetworkConnectionError
hostData HostData
password [
return NetworkConnectionError

Connect() public static method

Connect to a server GUID. NAT punchthrough can only be performed this way.

public static Connect ( string GUID, [ password ) : NetworkConnectionError
GUID string
password [
return NetworkConnectionError

Connect() public static method

Connect to the specified host (ip or domain name) and server port.

public static Connect ( string IP, int remotePort, [ password ) : NetworkConnectionError
IP string
remotePort int
password [
return NetworkConnectionError

Destroy() public static method

Destroy the object across the network.

public static Destroy ( GameObject gameObject ) : void
gameObject GameObject
return void

Destroy() public static method

Destroy the object associated with this view ID across the network.

public static Destroy ( NetworkViewID viewID ) : void
viewID NetworkViewID
return void

DestroyPlayerObjects() public static method

Destroy all the objects based on view IDs belonging to this player.

public static DestroyPlayerObjects ( NetworkPlayer playerID ) : void
playerID NetworkPlayer
return void

GetAveragePing() public static method

The last average ping time to the given player in milliseconds.

public static GetAveragePing ( NetworkPlayer player ) : int
player NetworkPlayer
return int

GetLastPing() public static method

The last ping time to the given player in milliseconds.

public static GetLastPing ( NetworkPlayer player ) : int
player NetworkPlayer
return int

RemoveRPCs() public static method

Remove all RPC functions which belong to this player ID.

public static RemoveRPCs ( NetworkPlayer playerID ) : void
playerID NetworkPlayer
return void

RemoveRPCs() public static method

Remove all RPC functions which belong to this player ID and were sent based on the given group.

public static RemoveRPCs ( NetworkPlayer playerID, int group ) : void
playerID NetworkPlayer
group int
return void

RemoveRPCs() public static method

Remove the RPC function calls accociated with this view ID number.

public static RemoveRPCs ( NetworkViewID viewID ) : void
viewID NetworkViewID
return void

RemoveRPCsInGroup() public static method

Remove all RPC functions which belong to given group number.

public static RemoveRPCsInGroup ( int group ) : void
group int
return void

SetReceivingEnabled() public static method

Enable or disables the reception of messages in a specific group number from a specific player.

public static SetReceivingEnabled ( NetworkPlayer player, int group, bool enabled ) : void
player NetworkPlayer
group int
enabled bool
return void

SetSendingEnabled() public static method

Enable or disable transmission of messages and RPC calls based on target network player as well as the network group.

public static SetSendingEnabled ( NetworkPlayer player, int group, bool enabled ) : void
player NetworkPlayer
group int
enabled bool
return void

SetSendingEnabled() public static method

Enables or disables transmission of messages and RPC calls on a specific network group number.

public static SetSendingEnabled ( int group, bool enabled ) : void
group int
enabled bool
return void