2.0.0a8 no way to null check Class Definitions

NeedsLoomis 2 years ago updated by Lazlo Bonin (Lead Developer) 2 years ago 1

(Maybe not a bug per say, but not sure where to post.)

Currently, unlike Class Assets, Class Definitions can't be added to a graph literally, and thus can't be null checked.

This means cross game object communications through Events and Modular Behavior Graphs will always throw errors if their targets don't have the correct Class Definitions, and thus aren't reliable.

Side note: Events being so picky feels weird.  At the moment, they throw an exception, which is a little extreme as it can halt flow.  If you are iterating through a list of objects (say objects in an explosion) and invoking an event on each one, the loop will fail if one of the objects doesn't have a listener.

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

Hi NeedsLoomis,

This was addressed in a number of ways in Alpha 9:

  • Bolt Components and Bolt Assets now have equality operators, so you can compare them against null
  • A new Is unit was introduced to do type checking against unknown object types

However, events shouldn't fail to invoke if they have no listener. If you experience this issue, please post the reproduction steps and stack trace in a separate thread.