Search Issue Tracker
Fixed in 2022.3.5f1
Fixed in 2022.3.X, 2023.1.X, 2023.2.X, 2023.2.0a22
Votes
1
Found in
2022.3.2f1
2023.1.0f1
2023.2.0a20
Issue ID
UUM-40355
Regression
Yes
UnsafeUtility.AlignOf<T>() reports incorrect value for Explicit layout structs when building with IL2CPP backend
Reproduction steps:
1. Open project “AlignOfBugReport.zip”
2. Enter Play Mode and observe “Align of test struct: 4” text displayed in Game view
3. Build and Run (might need to disable “Create Xcode Project” in the Build Settings first)
4. Observe Player
Expected result: “Align of test struct: 4” text is displayed
Actual result: “Align of test struct: 1” text is displayed
Reproducible with: 2022.2.0b8, 2022.3.2f1, 2023.1.0f1, 2023.2.0a20
Not reproducible with: 2021.3.27f1, 2022.2.0b7
Reproducible on: macOS Ventura 13.2.1 (Intel)
Notes:
- The correct value is reported in the Editor
- Changing the BugStruct definition from “{{LayoutKind.Explicit}}” to “{{LayoutKind.Sequential}}" in “AlignOfBug.cs” at line 4, while commenting out {{[FieldOffset(0)]}} at line 8 and {{[FieldOffset(4)]}} at line 9 gives expected results
Add comment
All about bugs
View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.
Latest issues
- A tile from the wrong layer gets selected in the Tile Palette when an Aseprite file with multiple layers is imported as a Tile Set
- Particle geometry is inverted, billboard is not lit, not receiving shadows in cubemap reflection when Render Alignment is set to View
- Menu bar list orders change when Domain Reload is performed
- Unity Hub Module icons wrap poorly when they occupy two rows
- "Add new query block" (+) button has no highlight when navigated with the keyboard
Resolution Note (fix version 2023.2):
Fixed field alignment of generic struct fields in il2cpp