diff --git a/Source/Tools/Flax.Build/Bindings/BindingsGenerator.Cpp.cs b/Source/Tools/Flax.Build/Bindings/BindingsGenerator.Cpp.cs index 0cb8982a2..d69b8dcbf 100644 --- a/Source/Tools/Flax.Build/Bindings/BindingsGenerator.Cpp.cs +++ b/Source/Tools/Flax.Build/Bindings/BindingsGenerator.Cpp.cs @@ -1204,7 +1204,7 @@ namespace Flax.Build.Bindings if (apiType != null) { if (parameterInfo.IsOut) - contents.Append(indent).AppendFormat("{1} {0}Temp;", parameterInfo.Name, new TypeInfo(parameterInfo.Type) { IsRef = false }.GetFullNameNative(buildData, caller)).AppendLine(); + contents.Append(indent).AppendFormat("{1} {0}Temp;", parameterInfo.Name, parameterInfo.Type.GetFullNameNative(buildData, caller, false)).AppendLine(); else contents.Append(indent).AppendFormat("auto {0}Temp = {1};", parameterInfo.Name, param).AppendLine(); if (parameterInfo.Type.IsPtr && !parameterInfo.Type.IsRef) diff --git a/Source/Tools/Flax.Build/Bindings/TypeInfo.cs b/Source/Tools/Flax.Build/Bindings/TypeInfo.cs index 7b2326527..df47c85e4 100644 --- a/Source/Tools/Flax.Build/Bindings/TypeInfo.cs +++ b/Source/Tools/Flax.Build/Bindings/TypeInfo.cs @@ -144,7 +144,7 @@ namespace Flax.Build.Bindings GenericArgs = BindingsGenerator.Read(reader, GenericArgs); } - public string GetFullNameNative(Builder.BuildData buildData, ApiTypeInfo caller) + public string GetFullNameNative(Builder.BuildData buildData, ApiTypeInfo caller, bool canRef = true, bool canConst = true) { var type = BindingsGenerator.FindApiTypeInfo(buildData, this, caller); if (type == null) @@ -155,7 +155,7 @@ namespace Flax.Build.Bindings return type.FullNameNative; var sb = new StringBuilder(64); - if (IsConst) + if (IsConst && canConst) sb.Append("const "); sb.Append(type.FullNameNative); if (GenericArgs != null) @@ -171,7 +171,7 @@ namespace Flax.Build.Bindings } if (IsPtr) sb.Append('*'); - if (IsRef) + if (IsRef && canRef) sb.Append('&'); return sb.ToString(); } diff --git a/Source/Tools/Flax.Build/Build/Plugins/NetworkingPlugin.cs b/Source/Tools/Flax.Build/Build/Plugins/NetworkingPlugin.cs index b24b887b3..d76fc43cc 100644 --- a/Source/Tools/Flax.Build/Build/Plugins/NetworkingPlugin.cs +++ b/Source/Tools/Flax.Build/Build/Plugins/NetworkingPlugin.cs @@ -241,7 +241,7 @@ namespace Flax.Build.Plugins // Deserialize arguments argNames += arg.Name; - contents.AppendLine($" {arg.Type.Type} {arg.Name};"); + contents.AppendLine($" {arg.Type.GetFullNameNative(buildData, typeInfo, false, false)} {arg.Name};"); contents.AppendLine($" stream->Read({arg.Name});"); } @@ -270,7 +270,7 @@ namespace Flax.Build.Plugins } // Serialize arguments - contents.AppendLine($" stream->Write(*({arg.Type.Type}*)args[{i}]);"); + contents.AppendLine($" stream->Write(*(const {arg.Type.GetFullNameNative(buildData, typeInfo, false, false)}*)args[{i}]);"); } // Invoke RPC