Unity 6 (6000.0.61f1) migration: type forwarders, save system, API updates#174
Open
leesiuuuu wants to merge 3 commits into
Open
Unity 6 (6000.0.61f1) migration: type forwarders, save system, API updates#174leesiuuuu wants to merge 3 commits into
leesiuuuu wants to merge 3 commits into
Conversation
Unity 6 moved tk2d sprite types to TeamCherry.TK2D.dll and video player types to TeamCherry.Cinematics.dll. Mods compiled against the old API expect these types in Assembly-CSharp, causing TypeLoadException at runtime. - PrePatcher now injects ExportedType forwarders from TeamCherry.TK2D and TeamCherry.Cinematics into the patched Assembly-CSharp.dll - New --mmhook mode in PrePatcher injects forwarders from MMHOOK_TeamCherry.* into MMHOOK_Assembly-CSharp.dll for On./IL. hook backward compat - PostBuild target runs HookGen for TeamCherry.TK2D and TeamCherry.Cinematics, then patches MMHOOK_Assembly-CSharp with the resulting forwarders Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Unity 6 replaced the BinaryFormatter-encrypted save format with plain UTF-8 JSON. The old LoadGame override manually handled decryption and BinaryFormatter deserialization; this is now handled entirely by the vanilla Platform layer. Remove the custom GetSaveStatsForSlot override (vanilla handles JSON correctly) and simplify LoadGame to call orig_LoadGame after hooking mod save data, removing ~200 lines of now-dead BinaryFormatter code. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Rigidbody2D.velocity -> linearVelocity (HeroController) - Object.FindObjectOfType -> FindFirstObjectByType (UIManager, GameCameras) - MenuButtonList.RecalculateNavigation: null-conditional to prevent NRE when menuButtonLists is not yet initialized - Language.Language moved to TeamCherry.Localization in Unity 6: add backward-compat stub in Assembly-CSharp namespace and update internal usages to TeamCherry.Localization.Language directly Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Author
CI failure explanationThe CI build fails because
These are new Unity 6 assemblies that the game ships alongside To unblock CI, the |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adapts the API to Unity 6 (6000.0.61f1) while maintaining backward
compatibility with mods compiled against the previous release.
Type forwarders for TeamCherry.* assemblies
Unity 6 split several types out of
Assembly-CSharpinto new assemblies:TeamCherry.TK2D(tk2d sprite system — 66 types)TeamCherry.Cinematics(video player — 8 types)TeamCherry.Localization(language system)PrePatcher now injects
ExportedTypeforwarders so existing mods resolvethese types without recompilation.
MMHOOK_Assembly-CSharpis similarlypatched to forward
On.*/IL.*hook types from the new MMHOOK files.Save system
GetSaveStatsForSlotoverride removed — vanilla Unity 6 handles JSON savescorrectly.
LoadGamesimplified: mod data is loaded aroundorig_LoadGame,dropping ~200 lines of now-dead BinaryFormatter handling.
Unity 6 API deprecations
Rigidbody2D.velocity→linearVelocity(HeroController)Object.FindObjectOfType→FindFirstObjectByType(UIManager, GameCameras)menuButtonListsinMenuButtonList.RecalculateNavigationLanguage.Languagemoved toTeamCherry.Localization: add backward-compat stubin Assembly-CSharp namespace, update internal usages
Testing
Built and verified against Unity 6 (6000.0.61f1) game binaries.
dotnet build Assembly-CSharp -p:Configuration=Release --runtime win-x64produces 0 warnings, 0 errors. API loads correctly, mod initialization
runs, and save data persists across sessions.