About bool isTransaction

I don’t really understand how 'isTransaction ’ is working. and what is for…
Is it C# word or something Unity created ?
It would be nice if someone can explain me what it is and where the word came from.
Thank you…

Hi Yume,

Welcome to our community! :slight_smile:

Check your code again. If we declared the variable somewhere with the type, e.g. bool isTransaction, it’s our variable, not some Unity variable. If we declared something, it’s ours.

The Update method gets called once per frame. This means the entire code block of the Update method gets executed each frame unless we add a restriction.

In our case, we do not want the rocket to do certain things if it crashed. The crashing sequence lasts for a couple of frames, so we somehow need to prevent certain parts of our code to be executed in the Update method.

We could achieve that with a flag. In our case, we named it isTransitioning. You could give it a different name if you want, maybe isDying or isWinning. Opt for a name which reflects the idea. You want to make your code as self-explanatory as possible.

And in our code, we define: If isTransitioning is true, this code is not supposed to get executed. We need to define rules in our code because Unity cannot remember anything and does not know anything that has not been defined. There is no “transition” until you define it. And even then, Unity does not know anything about it but the name. It just executes your code.

Did this clear it up for you? :slight_smile:


See also:

1 Like

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

Privacy & Terms