Skip to content

NetworkVariable of Struct or Class leads to infinite hang when on Player Gameobject #4008

@Sebastian-Schuchmann

Description

@Sebastian-Schuchmann

Description

Hello, I have this

public class ClientStateLocal : NetworkBehaviour
{
   public NetworkVariable<ClientTest> test;
}

which is just a simple struct (class has the same issue)

    [Serializable]
    public struct ClientTest : IEquatable<ClientTest>
    {
        public bool isModerator;
        public bool calibrationActive;

        public bool Equals(ClientTest other)
        {
            return isModerator == other.isModerator && calibrationActive == other.calibrationActive;
        }

        public override bool Equals(object obj)
        {
            return obj is ClientTest other && Equals(other);
        }

        public override int GetHashCode()
        {
            return HashCode.Combine(isModerator, calibrationActive);
        }
    }

And when this network variable is on the player spawned gameobject it just hangs. In the scene it is fine. When changing it to an int or some built-in type (I have not tried everything) it is fine. The editor is just frozen which makes it hard to debug.

Am I doing something wrong? I have a basic Netcode Setup, the Player Gameobject has just this component with just this Network Variable and of course Network Object and that is it. It just hangs.

This is on the latest version 2.12 but also on 2.10. MacOS Unity 6.3 LTS (6000.3.13f1)

Help would be appreciated!

Metadata

Metadata

Assignees

No one assigned

    Labels

    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