{
  "id": "unity/il2cpp-field-offset-error",
  "signature": "IL2CPP error: System.FieldAccessException: Field 'PlayerData.score' accessed from method 'PlayerController.Update' has incorrect offset 0x0004",
  "signature_zh": "IL2CPP错误: System.FieldAccessException: 从方法'PlayerController.Update'访问字段'PlayerData.score'时偏移量0x0004不正确",
  "regex": "IL2CPP error: System\\.FieldAccessException: Field '.*' accessed from method '.*' has incorrect offset",
  "domain": "unity",
  "category": "build_error",
  "subcategory": null,
  "root_cause": "IL2CPP code generation produces incorrect field offsets due to struct layout changes or version mismatch between editor and player assemblies.",
  "root_cause_type": "generic",
  "root_cause_zh": "IL2CPP代码生成由于结构体布局更改或编辑器和玩家程序集版本不匹配而产生错误的字段偏移量。",
  "versions": [
    {
      "version": "Unity 2022.3",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "Unity 2023.2",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "IL2CPP 2023",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "",
      "why_fails": "Rebuilding the player without cleaning the library folder often keeps stale cached assemblies with wrong offsets.",
      "fail_rate": 0.6,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "Changing the struct field order in code without updating all references can cause mismatched offsets.",
      "fail_rate": 0.4,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "Delete the Library/Bee and Library/IL2CPPCache directories, then rebuild from scratch to force fresh code generation.",
      "success_rate": 0.8,
      "how": "Delete the Library/Bee and Library/IL2CPPCache directories, then rebuild from scratch to force fresh code generation.",
      "condition": "",
      "sources": []
    },
    {
      "action": "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.",
      "success_rate": 0.7,
      "how": "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.",
      "condition": "",
      "sources": []
    }
  ],
  "workarounds_zh": [
    "Delete the Library/Bee and Library/IL2CPPCache directories, then rebuild from scratch to force fresh code generation.",
    "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."
  ],
  "transition_graph": {
    "leads_to": [],
    "preceded_by": [],
    "frequently_confused_with": []
  },
  "official_doc_url": "https://docs.unity3d.com/Manual/IL2CPP-ErrorMessages.html",
  "official_doc_section": null,
  "error_code": null,
  "verification_tier": "ai_generated",
  "confidence": 0.82,
  "fix_success_rate": 0.75,
  "resolvable": "partial",
  "first_seen": "2024-06-20",
  "last_confirmed": "2024-06-01",
  "last_updated": "2024-06-01",
  "evidence_count": 1,
  "tags": [],
  "locale": "en",
  "aliases": []
}