Search Issue Tracker
Fixed
Fixed in 2022.3.5f1, 2023.1.5f1, 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
- ACES Tonemapping causes banding artifacts and negative values in ColorGradingLUT when HDR is enabled and "High Dynamic Range" Grading mode is selected while Android Platform is used
- Android Player freezes when an Audio Source is playing and an incoming call is picked up and then hung up and the Audio Source is started again
- Green success icon is poorly visible in the light Unity theme
- Incorrect input into the Input Field when using Microsoft IME Japanese
- Multiplayer role "ClientAndServer" is displayed without the spaces in the "Play Mode Scenarios" window
Resolution Note (fix version 2023.2.0a22):
Fixed field alignment of generic struct fields in il2cpp