Add Write/Read methods to NetworkStream for INetworkSerializable sending in C# api
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
// Copyright (c) 2012-2024 Wojciech Figat. All rights reserved.
|
||||
// Copyright (c) 2012-2024 Wojciech Figat. All rights reserved.
|
||||
|
||||
using System;
|
||||
using System.Text;
|
||||
@@ -441,5 +441,23 @@ namespace FlaxEngine.Networking
|
||||
ReadBytes((byte*)&value, sizeof(bool));
|
||||
return value;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Writes the <see cref="INetworkSerializable"/> object data to the stream. Object has to be allocated.
|
||||
/// </summary>
|
||||
/// <param name="obj">The serializable object.</param>
|
||||
public void Write(INetworkSerializable obj)
|
||||
{
|
||||
obj.Serialize(this);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Reads the <see cref="INetworkSerializable"/> object data from the stream. Object has to be allocated.
|
||||
/// </summary>
|
||||
/// <param name="obj">The serializable object.</param>
|
||||
public void Read(INetworkSerializable obj)
|
||||
{
|
||||
obj.Deserialize(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user