RealityStop / Bolt.Addons.Community

A community-driven project for extending Unity Bolt
MIT License
251 stars 34 forks source link

Fuzzy finder hanging/failing on first open after Play mode #64

Closed DragonMapMaker closed 4 months ago

DragonMapMaker commented 11 months ago

Hi there, I am trying to upgrade my project from Unity 2019 LTS to 2022 LTS. It's a large complex project with many assets and scriptable objects (thousands). I use bolt to control the program flow with state machines. I have been using the Bolt Community addons in 2019 without any issues.

When switching to 2022 I have encountered some issues with the Visual Scripting (Fuzzy Finder) and I believe they are down to something the Community addons are doing as removing them resolves the problems.

System: Intel 13700k, 7000Mbs M.2 SSD, Windows 11 Unity 2022.3.13f1 (also tested 2022.3.7f1 with same results)

Issue: With Bolt.Addons.Community installed (tried v3.1, v3.1.1, v3.1.2) the Fuzzy finder hangs for upwards of 45 seconds when first trying to open it, then it fails to load with a timeout error. Processdeligates (Regenerating nodes makes no difference) Error:

Failed to fetch node options for fuzzy finder (error log below). Try rebuilding the node options from 'Edit > Project Settings > Visual Scripting > Node Library > Regenerate Nodes'.

System.TimeoutException: Time-out exceeded on Unity API thread function delegate. Potential deadlock. at Unity.VisualScripting.UnityAPI.Await[T] (System.Func1[TResult] func, System.Nullable1[T] timeout) [0x000a0] in .\Library\PackageCache\com.unity.visualscripting@1.9.1\Editor\VisualScripting.Core\Utilities\UnityAPI.cs:163 at Unity.VisualScripting.UnityAPI.Await[T] (System.Func`1[TResult] func) [0x00000] in .\Library\PackageCache\com.unity.visualscripting@1.9.1\Editor\VisualScripting.Core\Utilities\UnityAPI.cs:109 at Unity.VisualScripting.UnitBase.Subset (Unity.VisualScripting.UnitOptionFilter filter, Unity.VisualScripting.GraphReference reference) [0x00029] in .\Library\PackageCache\com.unity.visualscripting@1.9.1\Editor\VisualScripting.Flow\Options\UnitBase.cs:392 at Unity.VisualScripting.UnitOptionTree.Prewarm () [0x00015] in .\Library\PackageCache\com.unity.visualscripting@1.9.1\Editor\VisualScripting.Flow\Options\UnitOptionTree.cs:43 UnityEngine.Debug:LogError (object) Unity.VisualScripting.UnitOptionTree:Prewarm () (at ./Library/PackageCache/com.unity.visualscripting@1.9.1/Editor/VisualScripting.Flow/Options/UnitOptionTree.cs:47) Unity.VisualScripting.FuzzyWindow/<>c__DisplayClass24_0:b__0 () (at ./Library/PackageCache/com.unity.visualscripting@1.9.1/Editor/VisualScripting.Core/Interface/Fuzzy/FuzzyWindow.cs:312) Unity.VisualScripting.FuzzyWindow:Work () (at ./Library/PackageCache/com.unity.visualscripting@1.9.1/Editor/VisualScripting.Core/Interface/Fuzzy/FuzzyWindow.cs:1147) System.Threading.ThreadHelper:ThreadStart ()

Also this error as well:

TimeoutException: Time-out exceeded on Unity API thread function delegate. Potential deadlock. Unity.VisualScripting.UnityAPI.Await[T] (System.Func1[TResult] func, System.Nullable1[T] timeout) (at ./Library/PackageCache/com.unity.visualscripting@1.9.1/Editor/VisualScripting.Core/Utilities/UnityAPI.cs:163) Unity.VisualScripting.UnityAPI.Await[T] (System.Func1[TResult] func) (at ./Library/PackageCache/com.unity.visualscripting@1.9.1/Editor/VisualScripting.Core/Utilities/UnityAPI.cs:109) Unity.VisualScripting.UnitOptionTree+<Root>d__36.MoveNext () (at ./Library/PackageCache/com.unity.visualscripting@1.9.1/Editor/VisualScripting.Flow/Options/UnitOptionTree.cs:285) System.Collections.Generic.LargeArrayBuilder1[T].AddRange (System.Collections.Generic.IEnumerable1[T] items) (at <a790f10e63dd4341b206460141e07e75>:0) System.Collections.Generic.EnumerableHelpers.ToArray[T] (System.Collections.Generic.IEnumerable1[T] source) (at :0) System.Linq.Enumerable.ToArray[TSource] (System.Collections.Generic.IEnumerable1[T] source) (at <a790f10e63dd4341b206460141e07e75>:0) Unity.VisualScripting.FuzzyWindow.Populate (Unity.VisualScripting.FuzzyOptionNode node, System.Collections.Generic.IEnumerable1[T] childrenValues, System.Nullable`1[T] cancellation) (at ./Library/PackageCache/com.unity.visualscripting@1.9.1/Editor/VisualScripting.Core/Interface/Fuzzy/FuzzyWindow.cs:26) Unity.VisualScripting.FuzzyWindow+<>c__DisplayClass24_0.b__0 () (at ./Library/PackageCache/com.unity.visualscripting@1.9.1/Editor/VisualScripting.Core/Interface/Fuzzy/FuzzyWindow.cs:314) Unity.VisualScripting.FuzzyWindow.Work () (at ./Library/PackageCache/com.unity.visualscripting@1.9.1/Editor/VisualScripting.Core/Interface/Fuzzy/FuzzyWindow.cs:1147) UnityEngine.Debug:LogException(Exception) Unity.VisualScripting.FuzzyWindow:Work() (at ./Library/PackageCache/com.unity.visualscripting@1.9.1/Editor/VisualScripting.Core/Interface/Fuzzy/FuzzyWindow.cs:1153) System.Threading.ThreadHelper:ThreadStart()

Second attempt to open takes less time (10s ish) to fail. This is what the second fail usually looks like with the Fuzzy finder opening but only with the objects local nodes available. second fail

By the third time trying to open it it will most times open (2s) but sometimes will fail multiple times more.

After this it will open fine (1s) until I enter play mode, something I assume is uncached and after playmode has ended the fuzzy finder will once again stall and fail the first time opening, but take less time to fail (10-20s), second attempt may fail as well. Any time I enter play mode the Fuzzy finder breaks again and takes a few failed/stalled clickes to open.

Removing assets improves the speed the Fuzzy finder opens and with a large amount of assets (models and scriptable objects) removed the Fuzzy finder stops failing and seems to work normally again.

If I remove the Community Addons the Fuzzy Finder will start working as normal. In an empty project there's no issue with the Fuzzy finder and Community Addons.

It feels like something is being cached the first time the Fuzzy finder is opened, removing a large number of assets fixes the fuzzy finder. This wasn't an issue with 2019 and Bolt (same project), I assume a lot has changed ;)

Thanks for any help you might be able to give! I love the Addon and don't want to stop using it. The new stuff you folks have added looks really nice.

EDIT: As I couldn't really afford to wait on a solution/reply I went ahead and stripped the nodes I needed from the Community addons (Flow and Value reroute, LogicParam, MathParam and branch condition Args) and implemented my own versions of these and replaced all the comment nodes I had with Sticky Notes from Unity VS. I now have a fully working 2022 project without Community Addons and it's working great with base Unity VS.

S2NX7 commented 10 months ago

Hi thanks i am not sure what is causing this but i will look into it

Blitz54 commented 9 months ago

I also have this issue. I haven't really narrowed it down when it happens, but it will freeze for 5+ seconds, pop the error in the console, and then the second time I open the fuzzy finder it works.