On some newer versions of Unity, the BlockInspector will crash whenever the user selects a block in the flowchart window.
The inspector window will not populate, and the console will throw null reference errors every editor frame as long as the block is selected.
This is due to `activeBlockEditor` never getting instantiated properly. I suspect that this is due to recent API changes that made `Editor.CreateEditor(block)` create a generic Editor object, instead of a BlockEditor. Since the object is not actually the extended type, the reference becomes null after being cast using `as`.
This overload parameter ensures that the object is instantiated using the correct type. This fix should work for all versions, as it appears to have been an API option since at least Unity 5.2
Tested on Unity 2018.0.1f1 and 2019.2.1f1
- GUILayout.*Area no longer used was resulting in 0 pixels drawn
- Inspector height calc no longer driven by layout option that was filling 0 pixels
- Resize bar changes to correctly position and minimise incorrect values
-Removed selectedBlock and removed update code copying it into
selectedBlocks
-Changed BlockInspector display message when multiple blocks are
selected
-Added multi-select support via action key/shift+click and click+drag
-Block movement and context menu options now affect all selected blocks
-Flowchart’s SelectedBlock property now refers to the active selected
block rather than the sole selected block. It works similarly to
Unity’s Selection.activeObject
-Bumped flowchart version to 2 to upgrade previously serialized
selected blocks to new format (now a list of blocks rather than a
single block)
Made cache into a static list so it persists between serialization /
deserialization. This should guarantee that every editor that gets
created gets destroyed later.
CommandEditors are now only created / destroyed when needed instead of
every frame (much more efficient too).
Workarounds for compatibility issues with ReorderableList and
UnityEvent rendering. Selection rectangle now obscures the built-in
grabber on reorderable list and shift selection changes now happen on
next frame instead of immediately.
As a side effect, the shift selection logic is now more straightforward.
Icon displayed beside any currently executing sequences.
Icon displayed beside any currently executing command in selected
sequence.
Can now select & edit commands while game is running.
Sequences now resize correctly when name changes.
Added texture resources for sequence node types.
Sequences now have multiple shapes (Event, Process, Choice types)
Sequences can now have a description displayed underneath the node.
Can set the ‘Execute On Event’ property to define when a sequence
starts executing.
Added a ‘Start Game’ event handler.
Removed old system of specifying a start sequence on the Fungus Script.
All executing sequences are shown in blue in the Fungus Script window.
A Sequence may not be executed until any previous execution has
finished.
If a selected sequence is deleted, selection reverts back to the Fungus
Script object.
Sequences are now shown as simple coloured nodes in Fungus Script
window.
Commands for the selected sequence are now shown in the full inspector
window.
FungusScript window now continues to display the most recently selected
script.
Fungus Script window now refreshes every frame.
Can zoom out further on Fungus Script window.
Fungus Script window and Sequence inspectors now have separate context
menus.