# IL2CPP error: Stack overflow in method 'PlayerController.Update' due to infinite recursion

- **ID:** `unity/il2cpp-stack-overflow-recursive`
- **Domain:** unity
- **Category:** runtime_error
- **Error Code:** `IL2CPP-404`
- **Verification:** ai_generated
- **Fix Rate:** 93%

## Root Cause

A recursive method call without a base case, or an unintended circular reference, causes the call stack to exceed the maximum depth.

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| Unity 2022.3 | active | — | — |
| Unity 2023.1 | active | — | — |
| Unity 2023.2 | active | — | — |

## Workarounds

1. **Identify and fix the recursion by adding a base case or using an iterative approach. For example, change a recursive function to a loop.** (95% success)
   ```
   Identify and fix the recursion by adding a base case or using an iterative approach. For example, change a recursive function to a loop.
   ```
2. **Add a recursion depth counter to break the loop after a certain number of calls.** (85% success)
   ```
   Add a recursion depth counter to break the loop after a certain number of calls.
   ```

## Dead Ends

- **Increase the stack size in Player Settings under 'IL2CPP Code Generation'.** — Increasing stack size only delays the crash; the underlying infinite recursion is not fixed. (80% fail)
- **Comment out the entire Update method.** — This removes functionality and does not address the recursion in other methods. (50% fail)
