-
Notifications
You must be signed in to change notification settings - Fork 465
Closed
Labels
priority:lowThis issue has low priority and will take some time to be resolvedThis issue has low priority and will take some time to be resolvedstat:importedStatus - Issue is tracked internally at UnityStatus - Issue is tracked internally at Unitytype:featureNew feature, request or improvementNew feature, request or improvement
Description
Description
One cannot modify NetworkVariables on in-scene placed NetworkObjects. When one does, you get the following warning message:
NetworkVariable is written to, but doesn't know its NetworkBehaviour yet. Are you modifying a NetworkVariable before the NetworkObject is spawned?
UnityEngine.Debug:LogWarning (object)
Unity.Netcode.NetworkVariableBase:SetDirty (bool) (at Library/PackageCache/com.unity.netcode.gameobjects@1.1.0/Runtime/NetworkVariable/NetworkVariableBase.cs:88)
Unity.Netcode.NetworkVariable`1<IngredientType>:Set (IngredientType) (at Library/PackageCache/com.unity.netcode.gameobjects@1.1.0/Runtime/NetworkVariable/NetworkVariable.cs:74)
Unity.Netcode.NetworkVariable`1<IngredientType>:set_Value (IngredientType) (at Library/PackageCache/com.unity.netcode.gameobjects@1.1.0/Runtime/NetworkVariable/NetworkVariable.cs:63)
Unity.Netcode.Editor.NetworkBehaviourEditor:RenderNetworkVariableValueType<IngredientType> (int) (at Library/PackageCache/com.unity.netcode.gameobjects@1.1.0/Editor/NetworkBehaviourEditor.cs:145)
System.Reflection.MethodBase:Invoke (object,object[])
Unity.Netcode.Editor.NetworkBehaviourEditor:RenderNetworkVariable (int) (at Library/PackageCache/com.unity.netcode.gameobjects@1.1.0/Editor/NetworkBehaviourEditor.cs:73)
Unity.Netcode.Editor.NetworkBehaviourEditor:OnInspectorGUI () (at Library/PackageCache/com.unity.netcode.gameobjects@1.1.0/Editor/NetworkBehaviourEditor.cs:176)
UnityEditor.EditorGUI/PopupCallbackInfo:SetEnumValueDelegate (object,string[],int)
and the NetworkVariable is reset to the default value.
Reproduce Steps
- Go to ClientDriven Bitesize sample commit highlighting the issue
- Open the Bootstrap scene and try to modify the in-scene placed Ingredient IngredientType (NetworkVariable).
- See the warning message and the NetworkVariable being reset.
Actual Outcome
NetworkVariables on in-scene placed NetworkObject was reset.
Expected Outcome
NetworkVariables on in-scene placed NetworkObject should not be reset and should be saved in the scene.
Screenshots
If applicable, add screenshots to help explain your problem.
Environment
- OS: Windows 11.
- Unity Version: 2021.3.12f1
- Netcode Version: v1.1.0
Additional Context
Add any other context about the problem here. Logs, code snippets would be useful here but please also consider attaching a minimal Unity project that reproduces the issue.
Metadata
Metadata
Assignees
Labels
priority:lowThis issue has low priority and will take some time to be resolvedThis issue has low priority and will take some time to be resolvedstat:importedStatus - Issue is tracked internally at UnityStatus - Issue is tracked internally at Unitytype:featureNew feature, request or improvementNew feature, request or improvement