Wait for Load Scene Async - Unit

Jöran Malek 4 years ago updated by PET 4 years ago 21


I just came across AsyncOperation not being available in Bolt, therefor I built around this limitation by exposing a WaitForAsyncOperation Unit.

Feel free to use it. Wait For Async Operation (Gist)

Bolt Version:
Unity Version:
Scripting Backend:
.NET Version (API Compatibility Level):

Hello! Where did you find instructions, how to create your own units?


I just looked up a WaitFor*-Unit in Object Explorer of Visual Studio (View -> Object Explorer) (or hit F12 while having the cursor on a WaitFor*-Unit, to get into Metadata).

From there I just created a class inheriting from WaitUnit (which is the base class for Waiting-Units) and implemented required methods.

Sidenote: IntelliSense and Metadata provide rich information you need for creating custom units without documentation.


Nice! I already started turning some of my macros native with icons and categorization just because of the original post. This will help a lot, something I've been toiling with off and on for awhile. Thanks for posting this info!

If you refer to converting your own scripts to units just look for them in the finder. All items that can be converted will be there. If You are referring to actually creating your own brand new ones then Lazlo is still working on the API documentation but am sure can give you a head start. Do a forum search, it has come up before.

Hi JasonJonesLASM, do you care to share some examples?

Sorry, couldn't because of the issue. I reverted back so I can work on it more in the mean time. Get Discord and send me a private message at JasonJonesLASM. I don't want to flood with my stuff on this post. But I'll show you how it works so far.

Just a warning, this doesn't seem to work since the update. Neither do the assets I'm working on. Doesn't show up. Not sure why. Perhaps some internal API changes?

Funny thing. I just looked up my graph and it shows up there (reference not deleted). But I'm not able to browse for this unit in finder.

May relate to getting this error.

Failed to provide option for 'Bolt.InvokeMember'.
System.InvalidCastException: Cannot cast from source type to destination type.
  at System.Attribute.GetCustomAttributes (System.Reflection.ParameterInfo element, Boolean inherit) [0x00010] in /Users/builduser/buildslave/mono/build/mcs/class/corlib/System/Attribute.cs:273 
  at Ludiq.AttributeUtility+AttributeCache..ctor (System.Reflection.ParameterInfo element) [0x0003f] in C:\Users\Lazlo\Projects\Ludiq\Ludiq.Core\Runtime\Reflection\AttributeUtility.cs:37 
  at Ludiq.AttributeUtility.GetAttributeCache (System.Reflection.ParameterInfo element) [0x00021] in C:\Users\Lazlo\Projects\Ludiq\Ludiq.Core\Runtime\Reflection\AttributeUtility.cs:186 
  at Ludiq.AttributeUtility.HasAttribute[AllowsNullAttribute] (System.Reflection.ParameterInfo element, Boolean inherit) [0x00000] in C:\Users\Lazlo\Projects\Ludiq\Ludiq.Core\Runtime\Reflection\AttributeUtility.cs:277 
  at Ludiq.MemberUtility.AllowsNull (System.Reflection.ParameterInfo parameterInfo) [0x00000] in C:\Users\Lazlo\Projects\Ludiq\Ludiq.Core\Runtime\Reflection\MemberUtility.cs:273 
  at Bolt.InvokeMember.Definition () [0x00150] in C:\Users\Lazlo\Projects\Ludiq\Bolt.Flow\Runtime\Flow\Framework\Codebase\InvokeMember.cs:105 
  at Bolt.Unit.Define () [0x00010] in C:\Users\Lazlo\Projects\Ludiq\Bolt.Flow\Runtime\Flow\Unit.cs:93 
Bolt.UnitBase:CacheStaticUnits() (at C:/Users/Lazlo/Projects/Ludiq/Bolt.Flow/Editor/Options/UnitBase.cs:119)
Bolt.TypeOptionsPage:Complete() (at C:/Users/Lazlo/Projects/Ludiq/Bolt.Flow/Editor/Windows/TypeOptionsPage.cs:94)
Bolt.TypeOptionsPage:OnContentGUI() (at C:/Users/Lazlo/Projects/Ludiq/Bolt.Flow/Editor/Windows/TypeOptionsPage.cs:81)
Ludiq.Page:DrawContent() (at C:/Users/Lazlo/Projects/Ludiq/Ludiq.Core/Editor/Windows/Page.cs:56)
Ludiq.Wizard:OnGUI() (at C:/Users/Lazlo/Projects/Ludiq/Ludiq.Core/Editor/Windows/Wizard.cs:103)
Ludiq.WrappedEditorWindow:OnGUI() (at C:/Users/Lazlo/Projects/Ludiq/Ludiq.Core/Editor/Windows/WrappedEditorWindow.cs:41)
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)

Yup, that's the errors I was getting on mine too. 

Odd, this is unrelated to the corruption issue but related to a change in attributes handling. I'll investigate today. When exactly does this happen for you guys?

Since update to 1.1.3.


Just imported your gist in my 1.1.3 project, updated unit options and it shows up fine.

Which version of Unity / .NET are you using?

2017.2,  .NET 3.5 Backend.

Hmm, very odd, just tested in 2017.2 / .NET 3.5 and I still don't get any error.

I can try a "blind" fix, but I'd much rather be able to reproduce this.

Edit: PM me on Discord and I can send you a DLL hotfix to see if it works.

PMed you. AliveDevil on Discord.
I'll try to get a minimal example setup which shows this behavior

What plugins do you have installed? Just checking that we can get a minimum reproduceable example.

  • ScriptableObject Factory (https://github.com/liortal53/ScriptableObjectFactory)
  • Graph Visualizer (https://github.com/Unity-Technologies/graph-visualizer)
  • Unity UI Extensions (https://bitbucket.org/UnityUIExtensions/unity-ui-extensions)

I have Rewired, 2d Toolkit, and DOTween. None of those scream a problem to me. I do have serialized objects in mine, but I tried with deleting my cs file and only using yours, and updating units. Still occurs.

I've talked with Joran on Discord and identified some causes for the bug. It seems related to internal issues in the old version of the Mono runtime that Unity uses. Working on fixes.

Ok excellent! Good to know.


Since I really want to use the Async Operations I decided to try this.

As you can see, the scene Loads but nothing after the WaitAsyncOperation triggers.
All I want to use is the "isDone":


I want to be sure that my scene is fully loaded before I do what's after that Wait.