Dipto Debnath
Dipto Debnath

Reputation: 11

NetworkVariableBase.MarkNetworkBehaviourDirty Error in Unity

public class Generate : NetworkBehaviour
{
    private NetworkVariable<float> decreament = new NetworkVariable<float>(10);
    void Update()
    {
        decreament.Value -= Time.deltaTime;
    }
}

This code gives me an error when I run this code in Unity and start the host, as well as if I directly close the game from the Unity Editor:

NullReferenceException: Object reference not set to an instance of an object
Unity.Netcode.NetworkVariableBase.MarkNetworkBehaviourDirty ()

What is the cause of this error?

Upvotes: 0

Views: 62

Answers (0)

Related Questions