Search Issue Tracker

Fixed in 2022.1.X

Fixed in 2019.4.X, 2020.3.X, 2021.1.X, 2021.2.X

Votes

0

Found in

2018.4

2019.4

2020.3

2020.3.11f1

2021.1

2021.2

2022.1

Issue ID

1346805

Regression

No

Marshal.OffsetOf() returns incorrect offset when building the project with IL2CPP Scripting Backend

IL2CPP

-

Reproduction steps:
1. Open the attached project ("IL2CppAlignmentBug.zip")
2. Open the "SampleScene" scene: Project window > Assets > Scenes > "SampleScene.assets"
3. Enter the Play-Mode, inspect the "offset" value printed in the Game window
4. Set the Scripting Backend as IL2CPP: Edit > Project Settings > Player > Other Settings
5. Build the project: File > Build Settings > Build And Run

Expected result: The Marshal.OffsetOf() method returns offset of 8 when project is built with IL2CPP Scripting Backend
Actual result: The Marshal.OffsetOf() method returns offset of 4 when project is built with IL2CPP Scripting Backend

Reproducible with: 2018.4.36f1, 2019.4.29f1, 2020.3.14f1, 2021.1.14f1, 2021.2.0b3, 2022.1.0a1

Note:
- Not reproducible with Mono Scripting Backend

  1. Resolution Note (fix version 2022.1):

    Fixed in: 2022.1.0a3

  2. Resolution Note (fix version 2021.2):

    Fixed in: 2021.2.0b7

  3. Resolution Note (fix version 2021.1):

    Fixed in: 2021.1.17f1

  4. Resolution Note (fix version 2020.3):

    Fixed in: 2020.3.20f1

  5. Resolution Note (fix version 2019.4):

    Fixed in: 2019.4.31f1

Add comment

Log in to post comment

All about bugs

View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.