diff --git a/Source/Engine/Networking/NetworkStream.cs b/Source/Engine/Networking/NetworkStream.cs
index 1163f54c3..f489ca5e2 100644
--- a/Source/Engine/Networking/NetworkStream.cs
+++ b/Source/Engine/Networking/NetworkStream.cs
@@ -338,6 +338,60 @@ namespace FlaxEngine.Networking
return new Vector4(ReadSingle(), ReadSingle(), ReadSingle(), ReadSingle());
}
+ ///
+ /// Writes data of type into the message.
+ ///
+ public void WriteFloat2(Float2 value)
+ {
+ WriteSingle(value.X);
+ WriteSingle(value.Y);
+ }
+
+ ///
+ /// Reads and returns data of type from the message.
+ ///
+ public Float2 ReadFloat2()
+ {
+ return new Float2(ReadSingle(), ReadSingle());
+ }
+
+ ///
+ /// Writes data of type into the message.
+ ///
+ public void WriteFloat3(Float3 value)
+ {
+ WriteSingle(value.X);
+ WriteSingle(value.Y);
+ WriteSingle(value.Z);
+ }
+
+ ///
+ /// Reads and returns data of type from the message.
+ ///
+ public Float3 ReadFloat3()
+ {
+ return new Float3(ReadSingle(), ReadSingle(), ReadSingle());
+ }
+
+ ///
+ /// Writes data of type into the message.
+ ///
+ public void WriteFloat4(Float4 value)
+ {
+ WriteSingle(value.X);
+ WriteSingle(value.Y);
+ WriteSingle(value.Z);
+ WriteSingle(value.W);
+ }
+
+ ///
+ /// Reads and returns data of type from the message.
+ ///
+ public Float4 ReadFloat4()
+ {
+ return new Float4(ReadSingle(), ReadSingle(), ReadSingle(), ReadSingle());
+ }
+
///
/// Writes data of type into the message.
///
diff --git a/Source/Tools/Flax.Build/Build/Plugins/NetworkingPlugin.cs b/Source/Tools/Flax.Build/Build/Plugins/NetworkingPlugin.cs
index 389beea01..f2b33d5a5 100644
--- a/Source/Tools/Flax.Build/Build/Plugins/NetworkingPlugin.cs
+++ b/Source/Tools/Flax.Build/Build/Plugins/NetworkingPlugin.cs
@@ -58,6 +58,9 @@ namespace Flax.Build.Plugins
{ "FlaxEngine.Vector2", new InBuildSerializer("WriteVector2", "ReadVector2") },
{ "FlaxEngine.Vector3", new InBuildSerializer("WriteVector3", "ReadVector3") },
{ "FlaxEngine.Vector4", new InBuildSerializer("WriteVector4", "ReadVector4") },
+ { "FlaxEngine.Float2", new InBuildSerializer("WriteFloat2", "ReadFloat2") },
+ { "FlaxEngine.Float3", new InBuildSerializer("WriteFloat3", "ReadFloat3") },
+ { "FlaxEngine.Float4", new InBuildSerializer("WriteFloat4", "ReadFloat4") },
{ "FlaxEngine.Quaternion", new InBuildSerializer("WriteQuaternion", "ReadQuaternion") },
};
diff --git a/Source/Tools/Flax.Build/Utilities/MonoCecil.cs b/Source/Tools/Flax.Build/Utilities/MonoCecil.cs
index 4ff78178a..506ed3efb 100644
--- a/Source/Tools/Flax.Build/Utilities/MonoCecil.cs
+++ b/Source/Tools/Flax.Build/Utilities/MonoCecil.cs
@@ -33,17 +33,26 @@ namespace Flax.Build
public static MethodDefinition GetMethod(this TypeDefinition type, string name)
{
- return type.Methods.First(x => x.Name == name);
+ var result = type.Methods.FirstOrDefault(x => x.Name == name);
+ if (result == null)
+ throw new Exception($"Failed to find method '{name}' in '{type.FullName}'.");
+ return result;
}
public static MethodDefinition GetMethod(this TypeDefinition type, string name, int argCount)
{
- return type.Methods.First(x => x.Name == name && x.Parameters.Count == argCount);
+ var result = type.Methods.First(x => x.Name == name && x.Parameters.Count == argCount);
+ if (result == null)
+ throw new Exception($"Failed to find method '{name}' (args={argCount}) in '{type.FullName}'.");
+ return result;
}
public static FieldDefinition GetField(this TypeDefinition type, string name)
{
- return type.Fields.First(x => x.Name == name);
+ var result = type.Fields.First(x => x.Name == name);
+ if (result == null)
+ throw new Exception($"Failed to find field '{name}' in '{type.FullName}'.");
+ return result;
}
public static bool IsScriptingObject(this TypeDefinition type)