Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Bepin GOs to use HideAndDontSave flags #222

Merged
merged 2 commits into from
Apr 6, 2021

Conversation

Kein
Copy link
Contributor

@Kein Kein commented Apr 6, 2021

Description

To prevent forceful destruction of the manager GOs by the game (see Oddworld: Soulstorm) via
Resources.UnloadUnusedAssets we can use https://docs.unity3d.com/ScriptReference/HideFlags.HideAndDontSave.html

Motivation and Context

Oddworld: Soulstorm (for example) uses aggressive resource management approach that forcefully unloads any objects, including those that were set to DontDestroyOnLoad(). There are 3 possible workarounds:

  1. Move away from GameObjects (unlikely, breaking)
  2. Use custom loaders for specific game that will patch game's code (unlikely, not relevant to Bepin itself)
  3. Resort to easier solution via custom object flags that will prevent it from being unloaded.

How Has This Been Tested?

Preliminary testing on Oddworld: Soulstorm (custom build of Unity 2019.4.12) for about an hour. Plugins used to be destroyed and unloaded after first scene change, now they persist.

Screenshots (if appropriate):

Checklist:

  • My code follows the code style of this project.

Copy link
Contributor

@ghorsington ghorsington left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me!

@ghorsington ghorsington merged commit 0a25349 into BepInEx:v5-lts Apr 6, 2021
ghorsington pushed a commit that referenced this pull request Apr 6, 2021
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.

None yet

2 participants