Unity Bug

Issues with example projects, specifically Space Shooter example in this case

Ex-Crow 3 years ago updated by Lazlo Bonin (Lead Developer) 3 years ago 9

In short, the example is not working anymore with the latest version of Bolt and Unity. Some flow machines are not attached to their objects.

Some object variables are lost.

The macros also have default unity icons for some reason.

When I browse for macros it doesn't find any in explorer. Macros do attach if dragged on directly though.

I assume other example projects are in a similar state.

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

After we trying to solve it in discord chat i was trying to figure and solve issues for this project... Here fully working project:
Tested on Unity 2018.3.f2 and Using Bolt v.1.4.1b4


Working on Fix

Uh, that's very worrisome, it seems like the script GUIDs changed. I'll have a look ASAP.

In which version did this start happening?

Not a Bug

Pasting my reply from Discord:

It seems that the cause is the method you import the package, not the version of Bolt or Unity.

The example ships as a full project, that already includes Bolt.

If you want to import it properly, you should download it, extract it all, then open it with the Unity Hub.

Then, to you can re-import a newer version of Bolt *from that project*.

If you extract only the contents of the Assets folder in your project, the Unity serialization might not be in order, and some references will be lost. Restarting Unity seems to fix them, but not if you already had made and saved modifications and saved (because then Unity would also save the broken state of the references).

Does that make sense? Can you try it this way and tell me if you still have issues?

The good news is that I can confirm it's not the GUIDs changing! But I'm still having trouble getting it running, even with Bolt 1.4.0f11, I'll see what's up with that.

Ok, I looked into this some more. Here are my findings:

  • Make absolutely sure you are importing a compatible version of .NET. The example projects are all setup to .NET 3.x by default, so if you import Bolt .NET 4.x, none of the components or assets are going to work. Either import Bolt .NET3 or upgrade the project to .NET4 before importing Bolt.
  • The default Unity icons appear because the Bolt asset was just imported. Everything still works normally, but Unity didn't rebuild its icon cache yet. You can confirm that by clicking on a macro, and the inspector will properly show up. Restarting Unity fixes the icon cache.
  • As a precautionary measure, try not to edit and re-save the scenes before importing Bolt. This might cause some lost scripts to be "saved as lost". Basically, don't start playing around in the project before Bolt is fully imported. Erring on the side of caution even further, you might want to restart Unity after importing Bolt in the example projec t.
  • I can confirm and reproduce the issue with the missing macros and variables, even in v.1.4.1b4. Surprise: it has to do with prefabs! Objects that are not prefab instances (like the background mover) don't lose any reference. But prefab objects like the player will lose all their macros and variables, even if you drag a new one from the project window to the scene hierarchy.

I'm looking into the prefab issue. It's hard to reproduce. The space shooter project has it, but my normal debug project doesn't. 

Unity Bug

I figured it out! That took quite a bit of testing.

Basically, if a Prefab was created in the old prefab workflow (2018.2 and below), like they were for example projects, it will fail to instantiate its Bolt components properly when opened in the new prefab workflow (2018.3 and above). Macro references will be null, variables will be missing, etc: as if the components were entirely reset.

The solution is simply to Reimport the prefab (right click menu). As a precaution, I would reimport the entire project (right click menu > Reimport All).

Then, the prefab instances all magically get fixed!

I will add this to the known issues page.