Skip to content

Commit 0ecf34c

Browse files
committed
Add AutoStaticsCleanup + fix typo
1 parent 4cbec9b commit 0ecf34c

5 files changed

Lines changed: 32 additions & 7 deletions

File tree

com.unity.netcode.gameobjects/Runtime/Messaging/INetworkMessage.cs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
#if UNITY_6000_6_OR_NEWER
2+
using Unity.Scripting.LifecycleManagement;
3+
#endif
4+
15
namespace Unity.Netcode
26
{
37
/// <summary>
@@ -44,8 +48,10 @@ internal interface INetworkMessage
4448
public int Version { get; }
4549
}
4650

47-
48-
internal static class MessageDeliveryType<T> where T : INetworkMessage
51+
#if UNITY_6000_6_OR_NEWER
52+
[AutoStaticsCleanup]
53+
#endif
54+
internal static partial class MessageDeliveryType<T> where T : INetworkMessage
4955
{
5056
internal static NetworkDelivery DefaultDelivery { get; private set; }
5157
internal static void Initialize()

com.unity.netcode.gameobjects/Runtime/NetworkVariable/Serialization/CollectionSerializationUtility.cs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,13 @@
33
using Unity.Collections;
44
using Unity.Collections.LowLevel.Unsafe;
55
using Unity.Mathematics;
6+
#if UNITY_6000_6_OR_NEWER
7+
using Unity.Scripting.LifecycleManagement;
8+
#endif
69

710
namespace Unity.Netcode
811
{
9-
internal static class CollectionSerializationUtility
12+
internal static partial class CollectionSerializationUtility
1013
{
1114
public static void WriteNativeArrayDelta<T>(FastBufferWriter writer, ref NativeArray<T> value, ref NativeArray<T> previousValue) where T : unmanaged
1215
{
@@ -258,7 +261,10 @@ public static void ReadListDelta<T>(FastBufferReader reader, ref List<T> value)
258261
// For HashSet and Dictionary, we need to have some local space to hold lists we need to serialize.
259262
// We don't want to do allocations all the time and we know each one needs a maximum of three lists,
260263
// so we're going to keep static lists that we can reuse in these methods.
261-
private static class ListCache<T>
264+
#if UNITY_6000_6_OR_NEWER
265+
[AutoStaticsCleanup]
266+
#endif
267+
private static partial class ListCache<T>
262268
{
263269
private static List<T> s_AddedList = new List<T>();
264270
private static List<T> s_RemovedList = new List<T>();

com.unity.netcode.gameobjects/Runtime/NetworkVariable/Serialization/NetworkVariableSerialization.cs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
using System;
2+
#if UNITY_6000_6_OR_NEWER
3+
using Unity.Scripting.LifecycleManagement;
4+
#endif
25

36
namespace Unity.Netcode
47
{
@@ -9,8 +12,11 @@ namespace Unity.Netcode
912
/// based on which constraints are met by `T` using reflection, which is done at module load time.
1013
/// </summary>
1114
/// <typeparam name="T">The type the associated NetworkVariable is templated on</typeparam>
15+
#if UNITY_6000_6_OR_NEWER
16+
[AutoStaticsCleanup]
17+
#endif
1218
[Serializable]
13-
public static class NetworkVariableSerialization<T>
19+
public static partial class NetworkVariableSerialization<T>
1420
{
1521
internal static INetworkVariableSerializer<T> Serializer = new FallbackSerializer<T>();
1622

com.unity.netcode.gameobjects/Runtime/NetworkVariable/Serialization/UserNetworkVariableSerialization.cs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
#if UNITY_6000_6_OR_NEWER
2+
using Unity.Scripting.LifecycleManagement;
3+
#endif
4+
15
namespace Unity.Netcode
26
{
37
/// <summary>
@@ -7,7 +11,10 @@ namespace Unity.Netcode
711
/// users to tell NetworkVariable about those extension methods (or simply pass in a lambda)
812
/// </summary>
913
/// <typeparam name="T">The type of value being serialized</typeparam>
10-
public class UserNetworkVariableSerialization<T>
14+
#if UNITY_6000_6_OR_NEWER
15+
[AutoStaticsCleanup]
16+
#endif
17+
public partial class UserNetworkVariableSerialization<T>
1118
{
1219
/// <summary>
1320
/// The write value delegate handler definition

com.unity.netcode.gameobjects/Runtime/SceneManagement/NetworkSceneManager.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -599,7 +599,7 @@ internal bool HasSceneAuthority()
599599
}
600600

601601
/// <summary>
602-
/// Handle NetworkSeneManager clean up
602+
/// Handle NetworkSceneManager clean up
603603
/// </summary>
604604
public void Dispose()
605605
{

0 commit comments

Comments
 (0)