Skip to content

Setting any NetworkVariable after upgrading from 1.0.2 to 1.1.0 throws a NullReferenceException #2385

@starchitectus

Description

@starchitectus

After upgrading my project, network variables have completely broken.

I have tested in the project with this simple test script:

public class NetworkVariableTester : MonoBehaviour
{
    NetworkVariable<float> floatVariable = new();

    private void Update()
    {
        floatVariable.Value = Time.time;
    }
}

This throws the following error on every frame:

NullReferenceException: Object reference not set to an instance of an object
Unity.Netcode.NetworkVariable`1[T].set_Value (T value) (at Library/PackageCache/com.unity.netcode.gameobjects@1.1.0/Runtime/NetworkVariable/NetworkVariable.cs:53)
NetworkVariableTester.Update () (at Assets/NetworkVariableTester.cs:12)

This error seems to come from the NetworkVariableSerialization system that was added in 1.1.0. I'm not sure why it is broken in my project and no other users seem to be reporting errors. Any help would be appreciated as the project is completely unusable until this is fixed.

Metadata

Metadata

Labels

priority:lowThis issue has low priority and will take some time to be resolvedstat:importedStatus - Issue is tracked internally at Unitytype:bugBug Report

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions