Skip to content

Commit b77055d

Browse files
committed
Remove serialization changes
1 parent 73a69ee commit b77055d

16 files changed

+520
-915
lines changed

com.unity.netcode.gameobjects/Runtime/Serialization/BufferSerializer.cs

Lines changed: 0 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
using System;
22
using Unity.Collections;
33
using UnityEngine;
4-
#if SCENE_MANAGEMENT_SCENE_HANDLE_AVAILABLE
5-
using UnityEngine.SceneManagement;
6-
#endif
74

85
namespace Unity.Netcode
96
{
@@ -294,20 +291,6 @@ public FastBufferWriter GetFastBufferWriter()
294291
/// <param name="value">The values to read/write</param>
295292
public void SerializeValue(ref Ray2D[] value) => m_Implementation.SerializeValue(ref value);
296293

297-
#if SCENE_MANAGEMENT_SCENE_HANDLE_AVAILABLE
298-
/// <summary>
299-
/// Read or write a SceneHandle value
300-
/// </summary>
301-
/// <param name="value">The value to read/write</param>
302-
public void SerializeValue(ref SceneHandle value) => m_Implementation.SerializeValue(ref value);
303-
304-
/// <summary>
305-
/// Read or write an array of SceneHandle values
306-
/// </summary>
307-
/// <param name="value">The values to read/write</param>
308-
public void SerializeValue(ref SceneHandle[] value) => m_Implementation.SerializeValue(ref value);
309-
#endif
310-
311294
// There are many FixedString types, but all of them share the interfaces INativeList<bool> and IUTF8Bytes.
312295
// INativeList<bool> provides the Length property
313296
// IUTF8Bytes provides GetUnsafePtr()
@@ -672,26 +655,6 @@ public bool PreCheck(int amount)
672655
/// <param name="value">The value to read/write</param>
673656
public void SerializeValuePreChecked(ref Ray2D[] value) => m_Implementation.SerializeValuePreChecked(ref value);
674657

675-
#if SCENE_MANAGEMENT_SCENE_HANDLE_AVAILABLE
676-
/// <summary>
677-
/// Serialize a SceneHandle, "pre-checked", which skips buffer checks.
678-
/// In debug and editor builds, a check is made to ensure you've called "PreCheck" before
679-
/// calling this. In release builds, calling this without calling "PreCheck" may read or write
680-
/// past the end of the buffer, which will cause memory corruption and undefined behavior.
681-
/// </summary>
682-
/// <param name="value">The value to read/write</param>
683-
public void SerializeValuePreChecked(ref SceneHandle value) => m_Implementation.SerializeValuePreChecked(ref value);
684-
685-
/// <summary>
686-
/// Serialize a SceneHandle array, "pre-checked", which skips buffer checks.
687-
/// In debug and editor builds, a check is made to ensure you've called "PreCheck" before
688-
/// calling this. In release builds, calling this without calling "PreCheck" may read or write
689-
/// past the end of the buffer, which will cause memory corruption and undefined behavior.
690-
/// </summary>
691-
/// <param name="value">The value to read/write</param>
692-
public void SerializeValuePreChecked(ref SceneHandle[] value) => m_Implementation.SerializeValuePreChecked(ref value);
693-
#endif
694-
695658
// There are many FixedString types, but all of them share the interfaces INativeList<bool> and IUTF8Bytes.
696659
// INativeList<bool> provides the Length property
697660
// IUTF8Bytes provides GetUnsafePtr()

com.unity.netcode.gameobjects/Runtime/Serialization/BufferSerializerReader.cs

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
using System;
22
using Unity.Collections;
33
using UnityEngine;
4-
#if SCENE_MANAGEMENT_SCENE_HANDLE_AVAILABLE
5-
using UnityEngine.SceneManagement;
6-
#endif
74

85
namespace Unity.Netcode
96
{
@@ -89,9 +86,6 @@ public void SerializeValue<T>(ref T value, FastBufferWriter.ForFixedStrings unus
8986
public void SerializeValue(ref Ray2D value) => m_Reader.ReadValueSafe(out value);
9087
public void SerializeValue(ref Ray2D[] value) => m_Reader.ReadValueSafe(out value);
9188

92-
public void SerializeValue(ref SceneHandle value) => m_Reader.ReadValueSafe(out value);
93-
public void SerializeValue(ref SceneHandle[] value) => m_Reader.ReadValueSafe(out value);
94-
9589
public void SerializeNetworkSerializable<T>(ref T value) where T : INetworkSerializable, new() => m_Reader.ReadNetworkSerializable(out value);
9690

9791
public bool PreCheck(int amount)
@@ -150,8 +144,5 @@ public void SerializeValuePreChecked<T>(ref T value, FastBufferWriter.ForFixedSt
150144

151145
public void SerializeValuePreChecked(ref Ray2D value) => m_Reader.ReadValue(out value);
152146
public void SerializeValuePreChecked(ref Ray2D[] value) => m_Reader.ReadValue(out value);
153-
154-
public void SerializeValuePreChecked(ref SceneHandle value) => m_Reader.ReadValue(out value);
155-
public void SerializeValuePreChecked(ref SceneHandle[] value) => m_Reader.ReadValue(out value);
156147
}
157148
}

com.unity.netcode.gameobjects/Runtime/Serialization/BufferSerializerWriter.cs

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
using System;
22
using Unity.Collections;
33
using UnityEngine;
4-
#if SCENE_MANAGEMENT_SCENE_HANDLE_AVAILABLE
5-
using UnityEngine.SceneManagement;
6-
#endif
74

85
namespace Unity.Netcode
96
{
@@ -88,11 +85,6 @@ public void SerializeValue<T>(ref T value, FastBufferWriter.ForFixedStrings unus
8885
public void SerializeValue(ref Ray2D value) => m_Writer.WriteValueSafe(value);
8986
public void SerializeValue(ref Ray2D[] value) => m_Writer.WriteValueSafe(value);
9087

91-
#if SCENE_MANAGEMENT_SCENE_HANDLE_AVAILABLE
92-
public void SerializeValue(ref SceneHandle value) => m_Writer.WriteValueSafe(value);
93-
public void SerializeValue(ref SceneHandle[] value) => m_Writer.WriteValueSafe(value);
94-
#endif
95-
9688
public void SerializeNetworkSerializable<T>(ref T value) where T : INetworkSerializable, new()
9789
{
9890
m_Writer.WriteNetworkSerializable(value);
@@ -153,9 +145,5 @@ public void SerializeValuePreChecked<T>(ref T value, FastBufferWriter.ForFixedSt
153145

154146
public void SerializeValuePreChecked(ref Ray2D value) => m_Writer.WriteValue(value);
155147
public void SerializeValuePreChecked(ref Ray2D[] value) => m_Writer.WriteValue(value);
156-
157-
public void SerializeValuePreChecked(ref SceneHandle value) => m_Writer.WriteValue(value);
158-
public void SerializeValuePreChecked(ref SceneHandle[] value) => m_Writer.WriteValue(value);
159-
160148
}
161149
}

com.unity.netcode.gameobjects/Runtime/Serialization/BytePacker.cs

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
using System;
22
using System.Runtime.CompilerServices;
33
using UnityEngine;
4-
#if SCENE_MANAGEMENT_SCENE_HANDLE_AVAILABLE
5-
using UnityEngine.SceneManagement;
6-
#endif
74

85
namespace Unity.Netcode
96
{
@@ -274,25 +271,6 @@ public static void WriteValuePacked(FastBufferWriter writer, Pose pose)
274271
WriteValuePacked(writer, pose.rotation);
275272
}
276273

277-
/// <summary>
278-
/// Writes the sceneHandle to the buffer.
279-
/// </summary>
280-
/// <param name="writer">The writer to write to</param>
281-
/// <param name="handle">SceneHandle to write</param>
282-
[MethodImpl(MethodImplOptions.AggressiveInlining)]
283-
#if SCENE_MANAGEMENT_SCENE_HANDLE_AVAILABLE
284-
public static void WriteValuePacked(FastBufferWriter writer, SceneHandle handle)
285-
#else
286-
internal static void WriteValuePacked(FastBufferWriter writer, SceneHandle handle)
287-
#endif
288-
{
289-
#if SCENE_MANAGEMENT_SCENE_HANDLE_NO_INT_CONVERSION
290-
WriteValuePacked(writer, handle.GetRawData());
291-
#else
292-
WriteValuePacked(writer, (int)handle);
293-
#endif
294-
}
295-
296274
/// <summary>
297275
/// Writes a string in a packed format
298276
/// </summary>

com.unity.netcode.gameobjects/Runtime/Serialization/ByteUnpacker.cs

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
using System;
22
using System.Runtime.CompilerServices;
33
using UnityEngine;
4-
#if SCENE_MANAGEMENT_SCENE_HANDLE_AVAILABLE
5-
using UnityEngine.SceneManagement;
6-
#endif
74

85
namespace Unity.Netcode
96
{
@@ -294,27 +291,6 @@ public static void ReadValuePacked(FastBufferReader reader, out Pose pose)
294291
pose = new Pose(position, rotation);
295292
}
296293

297-
/// <summary>
298-
/// Reads the sceneHandle from the stream.
299-
/// </summary>
300-
/// <param name="reader">The reader to read from</param>
301-
/// <param name="sceneHandle">SceneHandle to read</param>
302-
[MethodImpl(MethodImplOptions.AggressiveInlining)]
303-
#if SCENE_MANAGEMENT_SCENE_HANDLE_AVAILABLE
304-
public static void ReadValuePacked(FastBufferReader reader, out SceneHandle sceneHandle)
305-
#else
306-
internal static void ReadValuePacked(FastBufferReader reader, out SceneHandle sceneHandle)
307-
#endif
308-
{
309-
#if SCENE_MANAGEMENT_SCENE_HANDLE_NO_INT_CONVERSION
310-
ReadValuePacked(reader, out ulong rawHandle);
311-
sceneHandle = SceneHandle.FromRawData(rawHandle);
312-
#else
313-
ReadValuePacked(reader, out int rawHandle);
314-
sceneHandle = rawHandle;
315-
#endif
316-
}
317-
318294
/// <summary>
319295
/// Reads a string in a packed format
320296
/// </summary>

com.unity.netcode.gameobjects/Runtime/Serialization/FastBufferReader.cs

Lines changed: 0 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,6 @@
33
using Unity.Collections;
44
using Unity.Collections.LowLevel.Unsafe;
55
using UnityEngine;
6-
#if SCENE_MANAGEMENT_SCENE_HANDLE_AVAILABLE
7-
using UnityEngine.SceneManagement;
8-
#endif
96

107
namespace Unity.Netcode
118
{
@@ -1432,28 +1429,6 @@ internal void ReadValueSafeInPlace<TKey, TVal>(ref NativeHashMap<TKey, TVal> val
14321429
[MethodImpl(MethodImplOptions.AggressiveInlining)]
14331430
public void ReadValue(out Ray2D[] value) => ReadUnmanaged(out value);
14341431

1435-
/// <summary>
1436-
/// Read a SceneHandle
1437-
/// </summary>
1438-
/// <param name="value">the value to read</param>
1439-
[MethodImpl(MethodImplOptions.AggressiveInlining)]
1440-
#if SCENE_MANAGEMENT_SCENE_HANDLE_AVAILABLE
1441-
public void ReadValue(out SceneHandle value) => ReadUnmanaged(out value);
1442-
#else
1443-
internal void ReadValue(out SceneHandle value) => ReadUnmanaged(out value);
1444-
#endif
1445-
1446-
/// <summary>
1447-
/// Read a SceneHandle array
1448-
/// </summary>
1449-
/// <param name="value">the values to read</param>
1450-
[MethodImpl(MethodImplOptions.AggressiveInlining)]
1451-
#if SCENE_MANAGEMENT_SCENE_HANDLE_AVAILABLE
1452-
public void ReadValue(out SceneHandle[] value) => ReadUnmanaged(out value);
1453-
#else
1454-
internal void ReadValue(out SceneHandle[] value) => ReadUnmanaged(out value);
1455-
#endif
1456-
14571432

14581433
/// <summary>
14591434
/// Read a Vector2
@@ -1675,34 +1650,6 @@ internal void ReadValueSafeInPlace<TKey, TVal>(ref NativeHashMap<TKey, TVal> val
16751650
[MethodImpl(MethodImplOptions.AggressiveInlining)]
16761651
public void ReadValueSafe(out Ray2D[] value) => ReadUnmanagedSafe(out value);
16771652

1678-
/// <summary>
1679-
/// Read a SceneHandle
1680-
///
1681-
/// "Safe" version - automatically performs bounds checking. Less efficient than bounds checking
1682-
/// for multiple reads at once by calling TryBeginRead.
1683-
/// </summary>
1684-
/// <param name="value">the value to read</param>
1685-
[MethodImpl(MethodImplOptions.AggressiveInlining)]
1686-
#if SCENE_MANAGEMENT_SCENE_HANDLE_AVAILABLE
1687-
public void ReadValueSafe(out SceneHandle value) => ReadUnmanagedSafe(out value);
1688-
#else
1689-
internal void ReadValueSafe(out SceneHandle value) => ReadUnmanagedSafe(out value);
1690-
#endif
1691-
1692-
/// <summary>
1693-
/// Read a SceneHandle array
1694-
///
1695-
/// "Safe" version - automatically performs bounds checking. Less efficient than bounds checking
1696-
/// for multiple reads at once by calling TryBeginRead.
1697-
/// </summary>
1698-
/// <param name="value">the values to read</param>
1699-
[MethodImpl(MethodImplOptions.AggressiveInlining)]
1700-
#if SCENE_MANAGEMENT_SCENE_HANDLE_AVAILABLE
1701-
public void ReadValueSafe(out SceneHandle[] value) => ReadUnmanagedSafe(out value);
1702-
#else
1703-
internal void ReadValueSafe(out SceneHandle[] value) => ReadUnmanagedSafe(out value);
1704-
#endif
1705-
17061653
// There are many FixedString types, but all of them share the interfaces INativeList<bool> and IUTF8Bytes.
17071654
// INativeList<bool> provides the Length property
17081655
// IUTF8Bytes provides GetUnsafePtr()

com.unity.netcode.gameobjects/Runtime/Serialization/FastBufferWriter.cs

Lines changed: 0 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,6 @@
33
using Unity.Collections;
44
using Unity.Collections.LowLevel.Unsafe;
55
using UnityEngine;
6-
#if SCENE_MANAGEMENT_SCENE_HANDLE_AVAILABLE
7-
using UnityEngine.SceneManagement;
8-
#endif
96

107
namespace Unity.Netcode
118
{
@@ -1561,28 +1558,6 @@ public void WriteValueSafe<T>(NativeList<T> value, ForGeneric unused = default)
15611558
[MethodImpl(MethodImplOptions.AggressiveInlining)]
15621559
public void WriteValue(Ray2D[] value) => WriteUnmanaged(value);
15631560

1564-
/// <summary>
1565-
/// Write a SceneHandle
1566-
/// </summary>
1567-
/// <param name="value">the value to write</param>
1568-
[MethodImpl(MethodImplOptions.AggressiveInlining)]
1569-
#if SCENE_MANAGEMENT_SCENE_HANDLE_AVAILABLE
1570-
public void WriteValue(SceneHandle value) => WriteUnmanaged(value);
1571-
#else
1572-
internal void WriteValue(SceneHandle value) => WriteUnmanaged(value);
1573-
#endif
1574-
1575-
/// <summary>
1576-
/// Write a SceneHandle array
1577-
/// </summary>
1578-
/// <param name="value">the values to write</param>
1579-
[MethodImpl(MethodImplOptions.AggressiveInlining)]
1580-
#if SCENE_MANAGEMENT_SCENE_HANDLE_AVAILABLE
1581-
public void WriteValue(SceneHandle[] value) => WriteUnmanaged(value);
1582-
#else
1583-
internal void WriteValue(SceneHandle[] value) => WriteUnmanaged(value);
1584-
#endif
1585-
15861561
/// <summary>
15871562
/// Write a Vector2
15881563
///
@@ -1803,34 +1778,6 @@ public void WriteValueSafe<T>(NativeList<T> value, ForGeneric unused = default)
18031778
[MethodImpl(MethodImplOptions.AggressiveInlining)]
18041779
public void WriteValueSafe(Ray2D[] value) => WriteUnmanagedSafe(value);
18051780

1806-
/// <summary>
1807-
/// Write a SceneHandle
1808-
///
1809-
/// "Safe" version - automatically performs bounds checking. Less efficient than bounds checking
1810-
/// for multiple writes at once by calling TryBeginWrite.
1811-
/// </summary>
1812-
/// <param name="value">the value to write</param>
1813-
[MethodImpl(MethodImplOptions.AggressiveInlining)]
1814-
#if SCENE_MANAGEMENT_SCENE_HANDLE_AVAILABLE
1815-
public void WriteValueSafe(SceneHandle value) => WriteUnmanagedSafe(value);
1816-
#else
1817-
internal void WriteValueSafe(SceneHandle value) => WriteUnmanagedSafe(value);
1818-
#endif
1819-
1820-
/// <summary>
1821-
/// Write a SceneHandle array
1822-
///
1823-
/// "Safe" version - automatically performs bounds checking. Less efficient than bounds checking
1824-
/// for multiple writes at once by calling TryBeginWrite.
1825-
/// </summary>
1826-
/// <param name="value">the values to write</param>
1827-
[MethodImpl(MethodImplOptions.AggressiveInlining)]
1828-
#if SCENE_MANAGEMENT_SCENE_HANDLE_AVAILABLE
1829-
public void WriteValueSafe(SceneHandle[] value) => WriteUnmanagedSafe(value);
1830-
#else
1831-
internal void WriteValueSafe(SceneHandle[] value) => WriteUnmanagedSafe(value);
1832-
#endif
1833-
18341781
// There are many FixedString types, but all of them share the interfaces INativeList<bool> and IUTF8Bytes.
18351782
// INativeList<bool> provides the Length property
18361783
// IUTF8Bytes provides GetUnsafePtr()

com.unity.netcode.gameobjects/Runtime/Serialization/IReaderWriter.cs

Lines changed: 0 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
using System;
22
using Unity.Collections;
33
using UnityEngine;
4-
#if SCENE_MANAGEMENT_SCENE_HANDLE_AVAILABLE
5-
using UnityEngine.SceneManagement;
6-
#endif
74

85
namespace Unity.Netcode
96
{
@@ -294,20 +291,6 @@ void SerializeValue<T>(ref NativeList<T> value)
294291
/// <param name="value">The values to read/write</param>
295292
void SerializeValue(ref Ray2D[] value);
296293

297-
#if SCENE_MANAGEMENT_SCENE_HANDLE_AVAILABLE
298-
/// <summary>
299-
/// Read or write a SceneHandle value
300-
/// </summary>
301-
/// <param name="value">The value to read/write</param>
302-
public void SerializeValue(ref SceneHandle value);
303-
304-
/// <summary>
305-
/// Read or write an array of SceneHandle values
306-
/// </summary>
307-
/// <param name="value">The values to read/write</param>
308-
public void SerializeValue(ref SceneHandle[] value);
309-
#endif
310-
311294
/// <summary>
312295
/// Read or write a NetworkSerializable value.
313296
/// SerializeValue() is the preferred method to do this - this is provided for backward compatibility only.
@@ -648,25 +631,5 @@ void SerializeValuePreChecked<T>(ref T value, FastBufferWriter.ForFixedStrings u
648631
/// </summary>
649632
/// <param name="value">The value to read/write</param>
650633
void SerializeValuePreChecked(ref Ray2D[] value);
651-
652-
#if SCENE_MANAGEMENT_SCENE_HANDLE_AVAILABLE
653-
/// <param name="value">The value to read/write</param>
654-
/// <summary>
655-
/// Serialize a SceneHandle, "pre-checked", which skips buffer checks.
656-
/// In debug and editor builds, a check is made to ensure you've called "PreCheck" before
657-
/// calling this. In release builds, calling this without calling "PreCheck" may read or write
658-
/// past the end of the buffer, which will cause memory corruption and undefined behavior.
659-
/// </summary>
660-
public void SerializeValuePreChecked(ref SceneHandle value);
661-
662-
/// <summary>
663-
/// Serialize a SceneHandle array, "pre-checked", which skips buffer checks.
664-
/// In debug and editor builds, a check is made to ensure you've called "PreCheck" before
665-
/// calling this. In release builds, calling this without calling "PreCheck" may read or write
666-
/// past the end of the buffer, which will cause memory corruption and undefined behavior.
667-
/// </summary>
668-
/// <param name="value">The value to read/write</param>
669-
public void SerializeValuePreChecked(ref SceneHandle[] value);
670-
#endif
671634
}
672635
}

0 commit comments

Comments
 (0)