ManlyMarco/QuickAccessBox

[HS2] Bug: HS2_QuickAccessBox throws errors and can't perform search with it in StudioNEOV2

calscks opened this issue · 5 comments

version: 2.4.3.0
BepInEx: 5.14.15.0
BepisPlugins: 16.8.1
HS2API: 1.26

Problem:

  • performed search via quick access box's field, was trying to input "reflection probe".
  • typing one character from the string above leads to the cursor moving into the middle without the character showing in the field
    image
  • at this moment I've already typed "reflec" but still didn't show up.
  • after closing the quick access box, then re-opened it again, the partial string is now shown, but nothing is being searched.
    image

In the meantime, during studio load, this error is thrown:

[Error  :   BepInEx] System.NullReferenceException: Object reference not set to an instance of an object
  at KK_QuickAccessBox.UI.InterfaceManager.CreateSearchToolbarButton () [0x00031] in <436ebb8ea61e4fa98eca1e360df7121b>:0 
  at KK_QuickAccessBox.UI.InterfaceManager..ctor (System.Action`1[T] onClicked, System.Action`1[T] onSearchStringChanged) [0x00229] in <436ebb8ea61e4fa98eca1e360df7121b>:0 
  at KK_QuickAccessBox.QuickAccessBox.<LoadingCo>b__52_2 () [0x00000] in <436ebb8ea61e4fa98eca1e360df7121b>:0 
  at BepInEx.ThreadingHelper.Update () [0x0005a] in <be164cbbe0a546c59eda05037ff079c2>:0

Typing out one character in the search field leads to the error below:

NullReferenceException: Object reference not set to an instance of an object
  at KK_QuickAccessBox.QuickAccessBox.OnSearchStringChanged (System.String newStr) [0x0009f] in <436ebb8ea61e4fa98eca1e360df7121b>:0 
  at UnityEngine.Events.InvokableCall`1[T1].Invoke (T1 args0) [0x00011] in <a43c47796b1b4dc78509dc74aec2356b>:0 
  at UnityEngine.Events.UnityEvent`1[T0].Invoke (T0 arg0) [0x00023] in <a43c47796b1b4dc78509dc74aec2356b>:0 
  at UnityEngine.UI.InputField.SendOnValueChanged () [0x00023] in <f0cd79bc997b4fdfbb94781bafee7971>:0 
  at UnityEngine.UI.InputField.Insert (System.Char c) [0x00080] in <f0cd79bc997b4fdfbb94781bafee7971>:0 
  at UnityEngine.UI.InputField.Append (System.Char input) [0x000a3] in <f0cd79bc997b4fdfbb94781bafee7971>:0 
  at UnityEngine.UI.InputField.KeyPressed (UnityEngine.Event evt) [0x002a6] in <f0cd79bc997b4fdfbb94781bafee7971>:0 
  at UnityEngine.UI.InputField.OnUpdateSelected (UnityEngine.EventSystems.BaseEventData eventData) [0x0002d] in <f0cd79bc997b4fdfbb94781bafee7971>:0 
  at UnityEngine.EventSystems.ExecuteEvents.Execute (UnityEngine.EventSystems.IUpdateSelectedHandler handler, UnityEngine.EventSystems.BaseEventData eventData) [0x00001] in <f0cd79bc997b4fdfbb94781bafee7971>:0 
  at UnityEngine.EventSystems.ExecuteEvents.Execute[T] (UnityEngine.GameObject target, UnityEngine.EventSystems.BaseEventData eventData, UnityEngine.EventSystems.ExecuteEvents+EventFunction`1[T1] functor) [0x00070] in <f0cd79bc997b4fdfbb94781bafee7971>:0 
UnityEngine.DebugLogHandler:Internal_LogException(Exception, Object)
UnityEngine.DebugLogHandler:LogException(Exception, Object)
UnityEngine.Logger:LogException(Exception, Object)
UnityEngine.Debug:LogException(Exception)
UnityEngine.EventSystems.ExecuteEvents:Execute(GameObject, BaseEventData, EventFunction`1)
UnityEngine.EventSystems.StandaloneInputModule:SendUpdateEventToSelectedObject()
UnityEngine.EventSystems.StandaloneInputModule:Process()
UnityEngine.EventSystems.EventSystem:Update()
 
(Filename: <436ebb8ea61e4fa98eca1e360df7121b> Line: 0)

Full output log is also attached below to aid any investigations needed.
output_log.txt

Expectations:

  • quick access box works like just before

Actual:

  • cannot search anything and the search field goes wonky.

Thanks in advance!

Additonal info:
Rolling back to 2.4.1.0 fixed this issue for me.

Adding to this report. It seems to be related to Graphics plugin. Specifically, files in the lensdirts folder. As mentioned by pixelgrinder on IS Discord. I did some testing and it's not due to any particular files, but the number or size of the files. For example, with just one copy of the lens dirt image attached below, QuickAccessBox works fine. If I have 7 or 8+ copies of it, I get the errors described above.
lensDirt14

This can be recreated with other lens dirt images but with varying amount of copies. QuickAccessBox works fine when Graphics plugin is disabled.

Thanks for looking into this.

I can't reproduce the issue and I don't see anything between .1 and .3 that could cause this. I switched to using KKAPI methods instead of local copies and that's about it. There's nothing useful in log either. This sounds like an unintended side effect of something that the graphics plugin does but it could be anything really. If it's related to the toolbar button code then buttons in other plugins that rely on kkapi should blow up as well.

The bug is here:

_toolbarIcon = KKAPI.Studio.UI.CustomToolbarButtons.AddLeftToolbarToggle(iconTex, Visible, b => Visible = b).ControlObject.GetComponentInChildren<Image>();

The toolbar toggle creation doesn't guarantee synchronous control generation. If studio hasn't finished loading it merely queues the control for later creation so ControlObject is returning null at this point in time and blowing things up. See CustomToolbarButtons.cs lines 46-50.

Anything (such as Graphics loading a bunch of preview textures) that slows down studio startup a bit would cause this. Other plugins aren't affected because they aren't attempting to reference the created toolbar button at this point in the lifecycle.

Thanks, can you try this build? HS2_QuickAccessBox_2.4.3.0.zip

Thanks, can you try this build? HS2_QuickAccessBox_2.4.3.0.zip

Hi, yeah the attached build is working correctly, everything works fine and dandy now. Thanks a lot.

Issue can be closed after.