Case study 02 · Love Eden · United Tech · 2026
The account switch that was copying data instead of switching
The game could only hold one backend account per device, so signing in with a second email copied that account's data over yours. The correct entry point had existed all along.
- My role
- Senior Unity Developer. Designed, built and maintained this system.
- Constraint
- A live account system, real progress at stake, and iOS will not let an app relaunch itself
- Outcome
- Multiple accounts per device, each keeping its own progress, plus six unrelated login defects closed
- Stack
- C#PlayFabSign in with AppleGoogle Sign-InStrangeIoC
The problem
Signing in with a second email was supposed to switch accounts. What it did was copy the other account's data into the account already on the device, delete story progress as part of the process, and unlink the email on sign-out so the account lost its owner. Support had been seeing the symptoms for a long time without a diagnosis: progress that appeared to vanish, accounts that kept getting new IDs, story progress deleted as the price of signing in.
The cause was one call. The backend keeps its own record of who the current player is, separate from the login session, and an earlier attempt at real switching had logged into the new account directly, bypassing the backend's own login entry point. The session said account B while the backend still said account A, so every backend feature broke at once: empty store, unbuyable gems, inventory and profile disagreeing.
Faced with that, the original team stopped switching identities and copied the data instead, and the reasoning is written into the old code. Given what was known then it was a reasonable call. The constraint just turned out to be a function that had never been called.
What I built
Four rules hold it together. Identity is decided at launch, not mid-session. The backend is always entered through its own login door, so its record of who is playing is never wrong. Switching means save, write the switch to disk, reset local state, sign into the target: nothing is copied and nothing is transferred. And the disk record is what guarantees correctness, not the restart, so a failed restart still lands on the right account at the next launch.
Switching requires a full reinitialise and iOS does not let an app relaunch itself, so the game performs an in-place restart: it tears everything down and re-runs its own startup sequence behind the normal loading screen. To the player it looks like a load.
When the email belongs to another account, the player gets both accounts side by side with name, gem balance, progress and the real avatar, rebuilt layer by layer from that account's saved look. Then they choose: switch, and the app restarts into it, or stay, and the email attaches to the account they are already playing. The second option is irreversible, so it only happens on an explicit choice.
Six further defects came out of the same work, most of them affecting players who never touch account switching: signing in could write your data into someone else's account, Google asked for consent three times, signing out unlinked the email, every network retry silently moved the session back to the device's own account, re-signing into the same account asked whether you wanted to switch, and a reinstall could permanently stop cloud saving.
Decisions and trade-offs
Switch identity properly, through the backend's own login entry point
instead of keeping the copy-based workaround and hardening it
The copy approach could not be made correct. It destroyed story progress by design and left two accounts sharing one identity. Before adding to a workaround, it is worth asking whether the constraint it works around is still real.
Record the switch on disk before starting it
instead of performing the switch and trusting it to complete
A switch that dies halfway leaves a player in a half-built account, which is worse than either endpoint. Writing the intent first makes the operation resumable.
An in-place restart behind the loading screen
instead of asking the player to close and reopen the app
iOS does not allow a self-relaunch, and "please restart the app" is where players leave. Re-running the startup sequence gets the same clean state and looks like an ordinary load.
Rebuild the real avatar on the comparison screen
instead of a generic placeholder next to the account name
The player is being asked which account is theirs. A name and a number are weak evidence; the character they dressed is immediate.
Sign-out leaves the email attached
instead of unlinking on sign-out, as before
Unlinking detached the account from its owner, almost certainly the source of years of "the game keeps giving me a new account" reports. Signing out should end a session, not dissolve an identity.
Result
A device can hold several accounts, each with its own progress, and progress belongs to the account rather than to the device.
The more useful outcome was the six defects above. Most had nothing to do with account switching and had been producing support tickets for a long time without anyone connecting them to a cause.
This describes architecture and the reasoning behind it. No employer source code is reproduced here.
Building something that has to stay up after launch?