From 63d9e7f4c313563c5448b8b3cb5bc2efa16b5d47 Mon Sep 17 00:00:00 2001 From: walon Date: Fri, 24 Nov 2023 09:59:22 +0800 Subject: [PATCH] =?UTF-8?q?[fix]=20=E4=BF=AE=E5=A4=8D=E5=BD=93=E5=87=BA?= =?UTF-8?q?=E7=8E=B0=E9=9D=9E=E5=B8=B8=E8=A7=84=E5=AD=97=E6=AE=B5=E5=90=8D?= =?UTF-8?q?=E6=97=B6=E7=94=9F=E6=88=90=E7=9A=84=E6=A1=A5=E6=8E=A5=E5=87=BD?= =?UTF-8?q?=E6=95=B0=E4=BB=A3=E7=A0=81=E6=96=87=E4=BB=B6=E6=9C=89=E7=BC=96?= =?UTF-8?q?=E8=AF=91=E9=94=99=E8=AF=AF=E7=9A=84bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Editor/MethodBridge/Generator.cs | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/Editor/MethodBridge/Generator.cs b/Editor/MethodBridge/Generator.cs index a93fdc7..d80005d 100644 --- a/Editor/MethodBridge/Generator.cs +++ b/Editor/MethodBridge/Generator.cs @@ -357,11 +357,12 @@ namespace HybridCLR.Editor.MethodBridge foreach (var field in ci.fields) { uint offset = field.field.FieldOffset.Value; - string fieldName = $"__{field.field.Name.Replace('<', '_').Replace('>', '_')}_{index}"; + string fieldName = $"__{index}"; + string commentFieldName = $"{field.field.Name}"; lines.Add("\t#pragma pack(push, 1)"); - lines.Add($"\tstruct {{ {(offset > 0 ? $"char {fieldName}_offsetPadding[{offset}];" : "")} {field.type.GetTypeName()} {fieldName};}};"); + lines.Add($"\tstruct {{ {(offset > 0 ? $"char {fieldName}_offsetPadding[{offset}];" : "")} {field.type.GetTypeName()} {fieldName};}}; // {commentFieldName}"); lines.Add($"\t#pragma pack(pop)"); - lines.Add($"\tstruct {{ {field.type.GetTypeName()} {fieldName}_forAlignmentOnly;}};"); + lines.Add($"\tstruct {{ {field.type.GetTypeName()} {fieldName}_forAlignmentOnly;}}; // {commentFieldName}"); ++index; } } @@ -376,8 +377,9 @@ namespace HybridCLR.Editor.MethodBridge int index = 0; foreach (var field in ci.fields) { - string fieldName = $"__{field.field.Name.Replace('<', '_').Replace('>', '_')}_{index}"; - lines.Add($"\t{field.type.GetTypeName()} {fieldName};"); + string fieldName = $"__{index}"; + string commentFieldName = $"{field.field.Name}"; + lines.Add($"\t{field.type.GetTypeName()} {fieldName}; // {commentFieldName}"); ++index; } if (classSize > 0)