Unity 6 scene.handle compatability fix.#130
Unity 6 scene.handle compatability fix.#130slidedrum wants to merge 2 commits intooriginalnicodr:masterfrom
Conversation
…ity 6. Replaced most of them with scene.name
|
Hey, thanks for the PR! However, like yukieiji stated here, this cannot be fixed easily, and we would need to do a combined effort with different modloader frameworks to see whats the best way to solve this. So I will wait for what the rest of the modding community believes its the best course of action here and act on it. |
Makes sense, I figured there would be deeper issues, I don't know enough to figure them out. I got it working for my use case, figured I would share in case it was useful! However it ends up getting fixed, I hope it ends up happening sooner rather later. |
Fixes this issue.
Scene.GetNameInternal(int) no longer exists, and the new version is private. Created DoesDontDestroyOnLoadExist() method to replace it. There's probably a better way of doing this without iterating through all scenes, but if it only runs once on init, it's probably not horrible.
Removed all references to scene.handle, as it doesn't exist in Unity 6. Mostly replaced them with scene.name.
Commented out LoadedScenes.Add in SceneHandler.Update() I don't know if that has any negative effects, but it seems to work in the limited testing I did. Hopefully someone with more knowledge of the codebase can tell me if this is actually horrible.
"Tested" with Unity 6 game "Forever-Happy-Town demo" and Unity 2022 game "Mycopunk". By tested I just mean it loads without errors and seems to display correctly. I did not do any testing for any deeper issues.