Skip to content

Unity 6 scene.handle compatability fix.#130

Open
slidedrum wants to merge 2 commits intooriginalnicodr:masterfrom
slidedrum:pr/Unity6-Scene.Handle-Fix
Open

Unity 6 scene.handle compatability fix.#130
slidedrum wants to merge 2 commits intooriginalnicodr:masterfrom
slidedrum:pr/Unity6-Scene.Handle-Fix

Conversation

@slidedrum
Copy link
Copy Markdown

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.

@originalnicodr
Copy link
Copy Markdown
Owner

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.

@slidedrum
Copy link
Copy Markdown
Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: UniverseLib Exception invoking onInitialized callback

2 participants