Skip to content

1.6.0 is causing editor to crash on float/double network variables unless marked internal. #2709

@jackuoll

Description

@jackuoll

Description

Public Float and double networkvariables are visually broken in the editor, even if marked NonSerialized. Workaround is to set them internal if possible.

Reproduce Steps

  • Create new project
  • Install NGO 1.6.0
  • Create a new gameobject and add a script "TestScript", NetworkBehaviour
  • Add in a public float or double NetworkVariable (actually doesn't matter if this is serialized or nonserialized)
  • Save and go back to editor.
  • Unselect and reselect the gameobject, note the console becomes filled with errors about InvalidCastException and "Test Script" is visually broken in the editor.

Actual Outcome

Setting variables in the editor becomes unusable for the entire script (not limited to networkvariables).

Expected Outcome

Not that

Screenshots

image

Environment

  • OS: Windows 10
  • Unity Version: [e.g. 2022.2.21f1]
  • Netcode Version: [e.g. 1.6.0]

Additional Context

using System;
using Unity.Netcode;

public class TestScript : NetworkBehaviour
{
    [NonSerialized] public NetworkVariable<float> SomeFloat = new NetworkVariable<float>();
}

Metadata

Metadata

Assignees

Labels

stat:importedStatus - Issue is tracked internally at Unitytype:bugBug Report

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions