Fix C# structures memory packing to match C++ better

#2709
This commit is contained in:
Wojtek Figat
2024-09-19 19:35:45 +02:00
parent ba701eb4d3
commit 075c224022
2 changed files with 3 additions and 3 deletions

View File

@@ -1542,7 +1542,7 @@ namespace Flax.Build.Bindings
var structIndent = "";
if (buildData.Target != null & buildData.Target.IsEditor)
structContents.Append(structIndent).AppendLine("[HideInEditor]");
structContents.Append(structIndent).AppendLine("[StructLayout(LayoutKind.Sequential)]");
structContents.Append(structIndent).AppendLine("[StructLayout(LayoutKind.Sequential, Pack = 2)]");
structContents.Append(structIndent).Append("public struct ").Append(structureInfo.Name).Append("Internal");
if (structureInfo.BaseType != null && structureInfo.IsPod)
structContents.Append(" : ").Append(GenerateCSharpNativeToManaged(buildData, new TypeInfo { Type = structureInfo.BaseType.Name }, structureInfo));