DorCoMaNdO/Reactor-Essentials

Feature suggestion: dependencies

Popeye4242 opened this issue · 8 comments

Hi,

having a lot of options can make the options list very long very fast. Therefore dependencies might be useful where we can change an option and depending on that options values we show or hide other options.

I don't need this right now but I'll just leave this as an idea here.

Already added as part of 0.2.0-dev builds with properties MenuVisible and HudVisible, ideally used with the ValueChanged event.

image
This works for the options on the left. The options in the game menu can still not be disabled.
image

You set MenuVisible to false right? Does it work when you reopen the menu?

When I close the menu and reopen it then all custom options disappear. Including the ones where the visibility wasn't toggled.

I'll take a look

Will be fixed with 0.2.0-dev.3, I'll also recommend using CustomOption.RaiseValueChanged(false); (on plugin load) after the update too, to update the option visibility to the default/currently selected value when first loading into the game.

Should be solved now, please let me know if you encounter any other issues.

I get the following NullReferenceException when opening the GameOptionsMenu, after doing something specific:

  • Open the GameOptionsMenu -> CustomOption will be created
  • Close the GameOptionsMenu
  • On the created CustomOption, set MenuVisible to false
  • Reopen the GameOptionsMenu

After reopening the GameOptionsMenu, the NullReferenceException occurs (It should happen in GetGameOptions(lowestY)
else if ((UnityEngine.Object) option.GameSetting != (UnityEngine.Object) null) { ((UnityEngine.Component) option.GameSetting).gameObject.SetActive(true); optionBehaviourList.Add(option.GameSetting); }

Somehow the component/gameObject seems to be null.

[Error : Detour] UnhollowerBaseLib.Il2CppException: System.NullReferenceException: Object reference not set to an instance of an object.
at UnhollowerBaseLib.Il2CppException.RaiseExceptionIfNecessary (System.IntPtr returnedException) [0x00014] in :0
at UnityEngine.Component.get_gameObject () [0x0002c] in <045cf7e91f5542268be1763686f1f2ad>:0
at Essentials.Options.CustomOption.GetGameOptions (System.Single lowestY) [0x00063] in <1254f1b337aa418a8f8bfbd277af126f>:0
at Essentials.Options.CustomOption+GameOptionsMenuPatchStart.Postfix (GameOptionsMenu __instance) [0x0002b] in <1254f1b337aa418a8f8bfbd277af126f>:0
at (wrapper dynamic-method) GameOptionsMenu.DMDGameOptionsMenu::Start(GameOptionsMenu)
at (wrapper dynamic-method) MonoMod.Utils.DynamicMethodDefinition.(il2cpp -> managed) Start(intptr,UnhollowerBaseLib.Runtime.Il2CppMethodInfo*)