Skip to content

Using an Enum in a NetworkVariable<T> breaks the inspector #2444

@JayPeet

Description

@JayPeet

Description

Using an enum in a NetworkVariable breaks the inspector for that component.

Reproduce Steps

I have included a small reproduction project, but the steps to do it are short.
EnumFailRepro.zip

  1. Make an enum
  2. Use it in a NetworkVariable on a NetworkBehaviour
  3. Add the NetworkBehaviour to a GameObject
  4. Note the errors in the logs + the inspector breaking when selecting the GameObject

Actual Outcome

The inspector broke, and some exceptions were logged

Expected Outcome

The inspector renders the inspector correctly with no exceptions

Environment

  • OS: Win10
  • Unity Version: 2022.2.10f1
  • Netcode Version: 08005ff
  • Netcode Commit: 08005ff

Additional Context

Looks like the issue was introduced in [https://github.com/Unity-Technologies/com.unity.netcode.gameobjects/commit/65e176e185aeba53988c2093649a9a1f5740dae7] due to adding the constraint of IEquatable to the RenderNetworkContainerValueType function. Enums are not able to implement interfaces, and they dont implement IEquatable. Unsure of how to fix this / dont have time to fix it atm.
Might need to fix it in RenderNetworkVariable itself and have 2 different code paths, one for NetworkVariable and one for NetworkList.

Broke:
image

After removing IEquatable from RenderNetworkContainerValueType
image

Metadata

Metadata

Assignees

Labels

priority:lowThis issue has low priority and will take some time to be resolvedstat:importedStatus - Issue is tracked internally at Unitytype:bugBug Reporttype:supportQuestions or other support

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