Pending Review

Can't remove Variables (Script) because FlowMachine (Script) depends on it

James Haidle 2 years ago updated by Daz 2 years ago 7

So this pops up in my Console whenever I hit Play to *stop* playing the code and return to the editor.  It shows up like 10 times.  Why would it try to remove the Variables Script at all?  Anyone know about this one? 

Bolt Version:
Bolt 1.4.3f2
Unity Version:
Unity 2019.1.0f2
Scripting Backend:
.NET Version (API Compatibility Level):
Pending Review

Hi James,

I must say I never saw that issue or had it reported. Do you have any third-party plugin or other part of your codebase that would try to manage components for you?

No, all of my code is in Bolt.  I do have 10 prefabs that are generated upon Start, and they have Flow Machines and Variables attached.  Maybe, when the run ends and they are removed, this causes the Error x 10?  Just a thought.

Do you have logic in your game/graphs that tries to Destroy the Variables components? That would seem like the only logical explanation. If you need to do that, you would need to destroy the Machine component first.

No, I didn't put any logic in to do that, but they are attached to prefabs.  So, the 10 game pieces with Object Variables on them are instantiated clones of the prefabs.  At the end of the run, the clones are, of course, destroyed, hence the error.  It doesn't seem to be causing any problems other than the console error, and it could probably be fixed by adjusting the timing somehow on my end, if I had any clue of what I was actually doing!  :)

Thanks for talking me through this, it makes more sense now.

I get the same in my project. It only occurs when returning to the editor, not during gameplay when objects are destroyed. I get it with objects that emit particles. Do your 10 game pieces have a particle component attached?

No, they are simple primitives that I've stacked together.  Yes, just when I stop the play session and return to the editor.  I'm certain it's because that is when the Instantiated prefab Clones are destroyed.  One error for each clone.  Ah, but the game Spaces, they do have particle emitters attached.  And I instantiate them as well.  It's worth noting that the spaces have a Flow Machine so I can put an object variable on them, but the Flow Machine has no Macro attached.  This is true of the Pieces as well, though they have no Particle System.

So … perhaps it is not the cloned pieces, but the cloned spaces whose destruction is causing the errors.  A clue, hmm?

Yeah it is reproducible. If you add a gameobject to an empty scene and just add a flowgraph it's fine. 

If a particle system is added to the object too, you get the "can't remove variables script" error when returning to the editor. This is the standard particle system, not the new vfx graph.