You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 46e98b3
Browse filesBrowse the repository at this point in the historyBrowse files
authored
fix: Private nested types in NetworkVariables in CoreCLR (#4239)
Copy file name to clipboardExpand all lines: com.unity.netcode.gameobjects/CHANGELOG.md
+1Lines changed: 1 addition & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -18,6 +18,7 @@ Additional documentation and release notes are available at [Multiplayer Documen
18
18
19
19
### Fixed
20
20
21
+
- Ensured a useful and human readable error is logged when a NetworkVariable is trying to serialize a private or protected type. (#4239)
21
22
- Issue where `NetworkAnimator` logged an error for a trigger-conditioned transition into an Exit node, and a client that joined during that transition, or during one into a sub-state machine, did not synchronize with it. Transitions that pass through Exit, Entry or sub-state machine nodes now resolve to the state they reach, and a late-joining client cross-fades from the matching originating state when several states transition into the same destination. (#4238)
22
23
- Ensured all callbacks are wrapped with exception handling to avoid silent errors. (#4161)
Copy file name to clipboardExpand all lines: com.unity.netcode.gameobjects/Documentation~/upgrade-guide.md
+8Lines changed: 8 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -123,6 +123,14 @@ In version 2.x, the `Lerp` and `SmoothDampening` interpolation types smooth by d
123
123
124
124
Version 3.x introduces the foundations of the unified GameObject layer for Netcode for Entities, known as the hybrid prefab concept. Version 3.x doesn't enable this integration by default for standard GameObject workflows. Standard `NetworkBehaviour`, `NetworkVariable`, and RPC workflows work the same as in version 2.x.
125
125
126
+
## CoreCLR compilation changes
127
+
128
+
CoreCLR introduces a new compilation pipeline that changes some custom serialization generation.
129
+
130
+
### NetworkVariable serialization
131
+
132
+
The Mono compilation pipeline was capable of generating serialization for private and protected types. With CoreCLR, this is no longer possible and will fail the compilation. Ensure any types used inside NetworkVariables in your project are declared as `public` or `internal`.
// Use the target assembly's defines: a Mono editor can build a CoreCLR player.
446
+
if(assemblyDefines.Contains("ENABLE_CORECLR"))
447
+
{
448
+
foreach(varhiddenTypeinhiddenTypes)
449
+
{
450
+
m_Diagnostics.AddError($"{type} cannot be used in a network variable - Cannot access the {hiddenType.Name} type to generate serialization as it is {(hiddenType.IsNestedPrivate?"private":"protected")}. To fix this, change the access modifier to internal or public.");
451
+
}
452
+
continue;
453
+
}
454
+
455
+
// Log a warning in Mono so we can warn users who haven't yet switched their projects over.
456
+
foreach(varhiddenTypeinhiddenTypes)
457
+
{
458
+
m_Diagnostics.AddWarning($"NetworkVariable serialization for {type.Name} will fail in CoreCLR! With CoreCLR generated code cannot access the {hiddenType.Name} type to generate serialization as it is {(hiddenType.IsNestedPrivate?"private":"protected")}. To fix this, change the access modifier to internal or public.");
0 commit comments