# IL2CPP error: System.FieldAccessException: Field 'PlayerData.score' accessed from method 'PlayerController.Update' has incorrect offset 0x0004

- **ID:** `unity/il2cpp-field-offset-error`
- **Domain:** unity
- **Category:** build_error
- **Verification:** ai_generated
- **Fix Rate:** 75%

## Root Cause

IL2CPP code generation produces incorrect field offsets due to struct layout changes or version mismatch between editor and player assemblies.

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| Unity 2022.3 | active | — | — |
| Unity 2023.2 | active | — | — |
| IL2CPP 2023 | active | — | — |

## Workarounds

1. **Delete the Library/Bee and Library/IL2CPPCache directories, then rebuild from scratch to force fresh code generation.** (80% success)
   ```
   Delete the Library/Bee and Library/IL2CPPCache directories, then rebuild from scratch to force fresh code generation.
   ```
2. **Ensure all assemblies are compiled with the same .NET version. Check Player Settings > Configuration > Api Compatibility Level and set to .NET Standard 2.1. Then perform a clean build.** (70% success)
   ```
   Ensure all assemblies are compiled with the same .NET version. Check Player Settings > Configuration > Api Compatibility Level and set to .NET Standard 2.1. Then perform a clean build.
   ```

## Dead Ends

- **** — Rebuilding the player without cleaning the library folder often keeps stale cached assemblies with wrong offsets. (60% fail)
- **** — Changing the struct field order in code without updating all references can cause mismatched offsets. (40% fail)
