0

Unexpected Graph Behavior. What could be wrong?

fotoshopt 2 years ago updated by Reality.Stop() 2 years ago 3

The following graph should:

If not "recharging", subtract the "energy load" (float) from the energy (float), then update "energy"

By default, it works great. When "isRecharging" = true, it stops the subtraction as expected.

However, once I toggle "isRecharging" back to false, the bottom portion of my graph animates correctly, but it won't actually subtract anymore.

Example:


Above, it will fire every X seconds, but the Get Object Variable (energy) never goes lower than 200. It will just fire forever, calculate 200 - 5 = 195, but the values on the graph stop updating.

I also verified that nothing else is updating "energy" in another script - this is the only script that references that object variable.

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

Looks like something is setting the Energy back to 200, it really does.  I know, I know, you said it wasn't, but your screenshot looks perfect.  I even built it myself to give it a test and that graph in isolation works just fine:


Fortunately, we should be able to isolate this graph pretty easily and prove whether it is a Bolt issue or not.

Create a new Object Value with 200 value, and just change these two highlighted nodes to reference it.  If it works right, then something is affecting your Energy variable.  If it doesn't, I have absolutely no idea.



Thanks for going through all that trouble to show me the error of my ways! You were right, and I'm embarrassed to admit that I had completely overlooked a different graph updating the energy value (even though I swear I spent hours trying to figure this one out!).

Again, I really appreciate you helping me out.


+1

No problem!  I'm glad it's working!  It does highlight a difference with regular coding though.  In regular coding, you can usually get a good idea of where your variable is being modified from via Find References, Find (search), or breakpoints.   But that currently doesn't carry through to Bolt.  Perhaps there is an idea for some tooling here...