Nebula
Core

NetworkVariable<T>

Replicated field, NGO-style: declare it on a NetworkBehaviour and Nebula discovers it.

generated from the sources
public sealed class NetworkVariable<T> : NetworkVariableBase

Replicated field, NGO-style: declare it on a NetworkBehaviour and Nebula discovers it. Only the authoritative worker may assign Value; every other copy (ghosts on neighbouring workers, clients) receives it and raises OnValueChanged.

public NetworkVariable<float> Health = new NetworkVariable<float>(100f);

Constructors

NetworkVariable

public NetworkVariable();
public NetworkVariable(T initialValue);

Properties

Value

public T Value { get; set; }

Events

OnValueChanged

public event Action<T, T> OnValueChanged;

Methods

Write

public override void Write(NetworkWriter writer);

Read

public override void Read(NetworkReader reader);

ToString

public override string ToString();

implicit operator T

public static implicit operator T(NetworkVariable<T> v);

On this page