Netick.Unity
Called on the server when a client tries to connect. Use to decide whether or not to allow this client to connect.
Called on the client when the connection to the server was refused, or simply failed.
Called to read inputs.
Called when Netick has been started.
Called when Netick has been shut down.
Called when a sandbox visibility changes. Use Sandbox.IsVisible to find if the sandbox is visible or not.
Called on both the client and the server when a scene load/unload operation was started.
Called on both the client and the server when a scene load/unload operation finished.
Called on the client when connection to the server has been initiated.
Called on the client when connection to the server ended, or when a network error caused the disconnection.
Called on when a specific player has joined the game. This is synced to all clients, including late-joiners..
Called on when a specific player has left the game. This is synced to all clients, including late-joiners..
Called when a network object has been created/initialized.
Called when a network object has been destroyed/recycled.
Called on the server when a specific client has connected.
Called on the server when a specific client has disconnected.
Called on the server when a specific player has connected.
Called on the server when a specific player has disconnected.
Called on both the client and the server when the scene has been loaded.
Called on both the client and the server before beginning to load the new scene.
NetworkSandbox represents a networked game instance in Netick. It encapsulates the entire simulation state for that instance.
Returns true if input is enabled on this sandbox. Use this to enable/disable input at runtime.
Returns true if this sandbox is visible. Use this to enable/disable visibility at runtime.
Attaches a to the simulation.
Detaches a from the simulation.
Instantiates a prefab. This must be called instead of .
Note: this must be called only for non-networked prefabs. If you want to instantiate a network prefab, use instead.
[Server Only] Instantiates a network prefab.
This must only be called on the server, since only the server can instantiate network prefabs.
Note: make sure the prefab has been registered.
Note: the specified input source will be given to every child of this prefab.
[Server Only] Instantiates a network prefab.
This must only be called on the server, since only the server can instantiate network prefabs.
Note: make sure the prefab has been registered.
Note: the specified input source will be given to every child of this prefab.
[Server Only] Instantiates a network prefab.
This must only be called on the server, since only the server can instantiate network prefabs.
Note: make sure the prefab has been registered.
Note: the specified input source will be given to every child of this prefab.
[Server Only] Instantiates a network prefab.
This must only be called on the server, since only the server can instantiate network prefabs.
Note: make sure the prefab has been registered.
Note: the specified input source will be given to every child of this prefab.
Gets the the associated NetworkObject (player object) with this player.
Gets the the associated script (player object) of type with this player.
Tries to get the the associated NetworkObject (player object) with this player.
Tries to get the the associated script (player object) of type with this player.
Gets the the associated NetworkObject (player object) with this player.
Gets the the associated script (player object) of type with this player.
Tries to get the the associated NetworkObject (player object) with this player.
Tries to get the the associated script (player object) of type with this player.
[Server Only] Sets the the associated NetworkObject (player object) with this player.
Gets the the associated (player object) with the local player.
Gets the the associated script (player object) of type with the local player.
Tries to get the the associated (player object) with the local player.
Tries to get the the associated script (player object) of type with the local player.
Retrieves the associated with the given .
On the server, this method can return any player by their ID. On the client, it only returns the local player or the server player.
Checks if a player with the specified exists in the simulation.
Gets the with the specified id. Returns null in case no object with that id exists.
The id of the
Tries to get the with the specified id.
The id of the
Tries to get the of a with the specified id.
The id of the network object
Gets all network behaviours (or Netick behaviours) in the simulation that have the type of .
Gets all network behaviours (or Netick behaviours) in the simulation that have the type of .
Gets a specific input for the next tick.
Sets a specific input for the next tick.
Converts ticks to time in seconds.
Converts ticks to time in seconds.
Converts time (in seconds) to ticks.
****************************************************** Deprecated ******************************************************
A list containing all connected clients currently.
Note: if you want the clients + the server, use .
A list containing all connected clients currently, in addition to the server (when started as a host).
Note: if you only want the clients, use .
Always always returns null except when called inside the body of an RPC method, it returns the we are executing RPCs from.
Always always returns null except when called inside the body of an RPC method, it returns the we are executing RPCs from. Works the same as , except when the RPC is called by the local player, it returns .
Initializes the pool for the specified prefab. After this method has been called for a certain prefab, all instances of that prefab will be recycled and reset when created/destroyed.
Note: this method should only be called on , in other words, just after Netick has been started.
Prefab to enable pooling for.
How many instances to be preloaded.
Pass true to hide inactive pool members.
Gets a Network Prefab by name.
The Network Prefab
[Server Only] Instantiates a network prefab.
This must only be called on the server, since only the server can instantiate network prefabs.
Note: make sure the prefab has been registered.
Note: the specified input source will be given to every child of this prefab.
[Server Only] Destroys a network object.
Note: never call this on a child of the original prefab, only the root of the prefab.
The object to destroy.
Finds the instance associated with the specified .
Returns null if networking is not running or if no matching sandbox is found for the object's scene.
The to find the sandbox for.
The associated with the object's scene, or null if not found.
Finds the instance associated with the specified .
Returns null if networking is not running or if no matching sandbox is found for the object's scene.
The to find the sandbox for.
The associated with the object's scene, or null if not found.
Use this to associate an object with this sandbox.
Name of this sandbox.
The NetickEngine instance attached to this sandbox.
The mode this sandbox was started in.
Returns true if this has been started.
Returns true if this is the server.
Returns true if this is a client.
Returns true if this is a host.
Returns true if this is a player, which is the case when running as a Client, Host, or in Single-Player mode.
Configuration data for Netick.
The associated with this . Always use this to perform physics queries inside the sandbox instead of .
The associated with this . Always use this to perform physics queries inside the sandbox instead of .
The associated with this .
Use this to enable/disable Physics Prediction in the client at runtime.
[Client Only] The of the server you are connected to. Returns null if you are not connected to any server, or if you are the server.
[Client Only] Returns true if this client is currently connected to a server.
The underlying transport used for low-level networking.
A list containing the ids of all connected players currently. This list is networked and synced to all clients.
The server the client is connected to.
A dictionary containing all simulated/registered network objects [] currently.
Use this to manage interest groups and area of interest (AoI) layers.
The local player of this sandbox instance.
The Local (predicted) Interpolation instance used for interpolating local/predicted objects. Includes useful interpolation data, such as the current interpolation alpha, the ticks being interpolated, and the local interpolation time (in seconds).
The Remote Interpolation instance used for interpolating remote objects on the client. Includes useful interpolation data, such as the current interpolation alpha, the ticks being interpolated, the remote interpolation time (in seconds), and the remote interpolation delay (in seconds).
Note: this is only valid in the client.
The simulation clock used for managing time in the network simulation.
Time period between network simulation steps. Same as
Time period between frames. Same as
Scaled time period between network simulation steps. This is the same as , but multiplied by .
Current (local/predicted) network time in seconds. Same as .
Current simulation tick.
On the server, it's always going forward/increasing.
On the client, during resimulations it returns the current re-simulated tick. To check for resimulations, use .
Last received tick on the client. On the server, it returns the same value as
Last predicted tick.
On the client, it always returns the predicted tick of the client, regardless of whether it's a resimulation or not.
On the server, it returns the same value as Sandbox.Tick
Returns true if we are currently re-simulating a previous input/tick of the past. On the server, it always returns false since only the clients resimulate.
[Client Only] The number of re-simulations that have been performed in this tick. This is only valid on the client (and during the re-simulation stage), and it returns 0 on the server.
[Client Only] Returns the current re-simulation step we are currently performing, if we are in the re-simulation stage. This is only valid on the client, and it returns 0 on the server.
Returns true if this NetworkFixedUpdate call is the first one executed in this frame. This excludes re-simulations, and it only refers to new/forward ticks.
Returns true if this NetworkFixedUpdate call is the last one executed in this frame. This excludes re-simulations, and it only refers to new/forward ticks.
Incoming data in kilobytes per second (KBps).
Outgoing data in kilobytes per second (KBps).
[Client Only] Estimation of incoming packets that are being lost. Value ranges between 0.0 and 1.0, with 1.0 meaning all packets are being lost.
[Client Only] Estimation of outgoing packets that are being lost. Value ranges between 0.0 and 1.0, with 1.0 meaning all packets are being lost.
[Client Only] Remote Interpolation delay in seconds.
[Client Only] The round-trip time (RTT) of the client in seconds.
Used to track network metrics and statistics.
Called after all NetworkFixedUpdate methods have been executed.
Note: it's called with every resimulation on the client.
Called before any NetworkFixedUpdate method have been executed.
Note: it's called with every resimulation on the client.
Called after all NetworkUpdate methods have been executed.
Called before any NetworkUpdate method have been executed.
Called after all NetworkRender methods have been executed.
Called before any NetworkRender method have been executed.
Use this to subscribe/unsubscribe to/from Netick events.
[Client Only] Connects to a remote server.
Note: if you are already connected to a server, and you want to connect to a different one, you have to disconnect before calling this. Otherwise this method does nothing.
Note: connectionData array length should not be more than 300 if you are using Netick Transport.
IP address of the server.
Port of the server.
RawValue sent with the connection request. Could be used to decide whether or not to allow the connection.
[Client Only] Disconnects this client from the server.
[Server Only] Disconnects a client from the server.
The client to be disconnected.
[Server Only] Creates a match. Only functional if the low-level transport has support for matchmaking.
Name of the match.
Requests an update to the match list. Only functional if the low-level transport has support for matchmaking.
[Server Only] Switches to a different scene. This must be called instead of or its variations. This should only be called for scenes included in the build of the game.
SceneBuildIndex of the desired scene.
[Server Only] Switches to a different scene. This must be called instead of or its variations. This should only be called for scenes included in the build of the game.
SceneBuildIndex of the desired scene.
[Server Only] Loads a scene asynchronously. This should only be called for scenes included in the build of the game.
[Server Only] Unloads a scene asynchronously.
This component is used to replicate the position and rotation of an object. Therefore, it’s the same as the Network Transform, the difference is that Network Rigidbody 2D must be used if you want to have client-side prediction over Box2D objects since it replicates several other properties necessary for correct prediction.
A networked array.
This component is used to replicate the position and rotation of an object. Therefore, it’s the same as the Network Transform, the difference is that Network Rigidbody must be used if you want to have client-side prediction over PhysX objects since it replicates several other properties necessary for correct prediction.
Executes the physics (PhysX or Box2D) simulation step during the NetworkFixedUpdate callback of Netick.
This component is used to replicate Unity's Animator parameters and states.
Handles prediction error correction smoothing for a float.
Handles prediction error correction smoothing for a transform.
Handles prediction error correction smoothing for a Vector3.
Handles prediction error correction smoothing for a Vector2.
Handles prediction error correction smoothing for a Quaternion.
Represents a network-serializable reference to a of type within the networked simulation.
This struct stores the object and behaviour ids, allowing retrieval of the referenced behaviour from a .
The type of being referenced.
Represents a network-serializable reference to a within the networked simulation.
This struct stores the object network id, allowing retrieval of the referenced object from a .
The type of being referenced.
This component is used to replicate the position and rotation of an object.
Instantly moves the object. By calling this method, the object won't be interpolated for one tick.
Instantly moves the object. By calling this method, the object won't be interpolated for one tick.
Instantly moves the object. By calling this method, the object won't be interpolated for one tick.
A helper struct that represents an angle in degrees, which automatically wraps to [0, 360) range.
Construct from raw degrees (auto-wrapped to [0, 360) internally).
Add this component to a GameObject to ensure only a single instance of it will exist at the same time, across all sandboxes.
Defines the start modes for Netick, which determine how the network is initialized.
Manages Netick and its sandboxes, and is used to start and shut down Netick.
The version of Netick.
The start mode of Netick.
Returns true if Netick is running, false otherwise.
Returns the list of all sandboxes currently running in Netick.
Returns the singleton instance of the Network class, which manages Netick.
Returns the configuration (of the first sandbox) used by Netick.
Returns true if Netick is running in headless mode (batch mode), false otherwise.
Initializes Netick. This is automatically called when you start Netick.
If you don't provide a , Netick will use the default config, which can be modified/found in (Netick -> Settings).
Shuts down Netick and destroys all sandboxes. The shutdown will occur in the next frame. For immediate shutdown, use:
Shuts down Netick and destroys all sandboxes immediately.
Shuts down a specific sandbox.
The sandbox to shut down.
Focus on a specific sandbox.
The sandbox to focus on.
Starts both a client (or clients) and a server.
Network port.
Number of client sandboxes to create.
Starts multiple peers together.
Network port.
Number of clients to create.
Should we start a server too.
Starts Netick as a client.
The sandbox representing the client
Starts Netick as a client.
The sandbox representing the client
Starts Netick in single player mode.
The sandbox representing the server
Starts Netick as a host.
Network port.
The sandbox representing the server
Starts Netick as a server.
Network port.
The sandbox representing the server
The containing this .
The this behaviour is attached to.
Called when this behaviour has been added to the simulation.
Called when this behaviour has been removed from the simulation.
Called every frame. Executed before NetworkFixedUpdate.
Called every fixed-time network step. Any changes to the networked state should happen here.
On the client, if you are the Input Source or if this Object.PredictionMode is set to Everyone, it will be called several times in one update/tick during resimulations. To check for resimulations, use [].
Called every frame. Executed after NetworkUpdate and NetworkFixedUpdate.
IMPORTANT NOTE: properties (which can be interpolated) marked with [] attribute will return interpolated values when accessed in this method.
Base class for all networked behaviors in Netick.
Inherit from this class to create network-synchronized logic.
Provides access to network state, input, and misc utility methods.
The network id of this .
The network id of this .
Returns true if this is a client.
Returns true if this is the server.
Returns true if this is the owner of this Object. In this version of Netick: Server=Owner.
Returns true if this is the host.
Returns true if this is a client or the host.
Returns true if this is providing inputs to this Object.
Returns true if we neither provide inputs nor own this .
Returns true if we are currently resimulating a previous input of the past. On the server, it always returns false since only the clients resimulate.
On the client returns true only if the client is predicting this object. On the server, always returns true.
On the client, returns true if this client is interested in this object. On the server, always returns true.
Returns the source (/) of inputs for this . If the source of inputs is remote (from a client) it returns that , while on the
input source itself it returns the local .
Use for the synced-to-everyone player id of the Input Source - because is only valid in the client for objects the client itself is the input source of, and it's null for everything else.
Returns the NetworkPlayerId of the input source of this object. This is synced to every client.
Returns the networked state size of this behavior in bytes.
Copies the state of this behavior into target.
Copies the state of this behavior into target.
Sets the state of this behavior. Ignores InputSource Relevancy.
Sets the state of this behavior. Ignores InputSource Relevancy.
Zeros out the networked state memory of this behavior. Ignores InputSource Relevancy.
Fetches a network input for this tick. Returns false if no input source is currently providing inputs to this Object, or when input loss occurs (in case of a remote input source).
Fetches a network input for this tick. Returns false if no input source is currently providing inputs to this Object, or when input loss occurs (in case of a remote input source).
Called in the client when the client becomes interested in this object.
Called in the client when the client becomes uninterested in this object.
Called in the server (or the client if it is the input source) when the input source of this Object has changed.
Called on the server when the input source of this Object has disconnected.
Config class for Netick.
Any GameObject which needs to be synced/replicated must have a Network Object component. It’s the component that tells Netick a GameObject is networked. Although not every child GameObject needs it, only the root has to have a Network Object.
The this belongs to.
The this belongs to.
The this represents in the Netick simulation.
Returns a network-serializable reference to this . This is used to get a networkable identifier for this object, which can be used for RPCs or network properties.
Returns the unique identifier of this in the Netick simulation. This id is assigned by the Netick when the object is added to the simulation and is used to identify the object across the network.
Returns the tick at which this was spawned locally. This is a local value, and is not synced.
Returns true if this has been added to the simulation by Netick, and thus has a valid id.
[Server Only] Returns true if has been called on this object in the server, and the object is scheduled to be removed from the simulation (destroyed) at the end of the current tick.
Returns the components attached to this .
Returns the components attached to this .
The parent of this object.
Returns true if this is a scene object (not a prefab instance). Scene objects are objects that are part of the scene and not instantiated from a prefab.
Returns true if this is a prefab object (not a scene object). Prefab objects are objects that are instantiated from a prefab and not part of the scene.
Returns the prefab id of this . This is used to identify the prefab from which this object was instantiated. If this object is a scene object, it returns -1.
Returns the scene id of this . This value is only unique per-scene, and not per the entire game.
Returns the runtime scene id of this . This value is only unique per-scene, and not per the entire game.
Returns true if this is a client.
Returns true if this is the server.
Returns true if this is the owner of this Object. In this version of Netick: Server=Owner.
Returns true if this is providing inputs for this .
Returns true if we neither provide inputs nor own this .
Returns true if we are currently resimulating a previous input of the past. On the server, it always returns false since only the clients resimulate.
Returns the source (/) of inputs for this . If the source of inputs is remote (from a client) it returns that , while on the
input source itself it returns the local .
Use for the synced-to-everyone player id of the Input Source - because is only valid in the client for objects the client itself is the input source of, and it's null for everything else.
Returns the NetworkPlayerId of the input source of this object. This is synced to every client.
[Client Only] On the client, returns true if this client is interested in this object. On the server, always returns true.
The interest group of this object. This can only be changed if BroadPhaseFilter is set to Custom.
Returns the networked state size of this object in bytes.
Zeros out the networked state memory of this object. Ignores InputSource Relevancy.
Copies the state of this object into target.
Copies the state of this object into target.
Sets the state of this object. Ignores InputSource Relevancy.
Sets the state of this object. Ignores InputSource Relevancy.
[Owner/InputSource Only] Changes the parent of this object.
The object which will become the parent of this object.