Skip to content

Unit Reference Do Once

RealityStop edited this page May 15, 2018 · 1 revision

Do Once

There are two variants to this node. These will likely be merged in a future version, at which time the individual units will be deprecated. Existing instances will continue to work and are safe to use in your projects, but expect these to change in the future.

Control Flow Variant

Imgur

Will let one Enter control flow through until the unit is reset via the Reset input. Note that the Reset port does NOT trigger the exit port. It merely resets the unit to let the next Enter through.

Note: This node does suffer from a race condition. If two different update nodes are wired to the Enter and the Reset (for example), it is arbitrary which will get triggered first. This is only a concern if two different events are wired to the two control flow inputs and you need the order to be reliably determined. If you have your Enter wired to an update node and are okay with a single frame delay, then you can ignore this race condition.

The Boolean Variant does not have this race condition.

Boolean Variant

Allows one Enter control flow through until is reset. Unlike the Control Flow variant, this one queries a boolean to determine if the unit is "reset", rather than requiring a second control flow.

The Test Reset control flow is entirely optional, and allows the unit to be reset without attempting to pass through with the Enter flow. In this regard, it acts much like the Control Flow Variant above, with the exception that the boolean dictates whether the unit is reset. However, because we have supplied a boolean to indicate the reset condition, the Enter flow will ALSO query the Reset boolean. This allows the unit to be reset without using the Test Reset flow at all. In these conditions, the Exit will fire and immediately lock the unit again.

So when do you need the Test Reset? The Test Reset solves a particular problem: querying the boolean when the Enter flow is not being triggered. If just the Enter and Reset are wired, the unit can only query the Reset when attempting to pass through. Here is an example usage that would not work without the Test Reset input wired, as the Reset value is only true when the Enter flow is not attempting to pass through the node.

Clone this wiki locally