Repeat Node

The Repeat node is used when you want to run a single or a sequence of Actions multiple times.

../../../../_images/new_repeat.gif

How to Setup a Repeat Node

In this tutorial we will make a sequence of Actions to repeat 3 times. In particular we will first dip a sterile cotton ball into alcohol, then we will rub the patient’s arm with the cotton ball to disinfect. We will repeat this process 3 times.

  1. Create the two Actions we mentioned above. Those will be both Use Actions.

    For a more detailed tutorial on Use Actions, you can look here

    Action 1: Use the cotton ball on the alcohol bottle.

    The Use Object is the cotton ball and the Use Collider the alcohol bottle.

    ../../../../_images/repeat_nodes_use_1.png

    Action 2: Use the cotton ball on the patients arm.

    The Use Object is the cotton ball and the Use Collider a holographic are over the patient’s arm.

    ../../../../_images/repeat_nodes_use_2.png

Note

Make sure to add a trigger collider to the holograhic area. In this way the action will trigger with the Use Object.

We also set the holographic area to destroy on perform.

The image below shows the final result with the two Actions linked in line.

../../../../_images/repeat_nodes.png
  1. Now we will set the loop (repeat) functionality. On the scenegraph editor press right click and select New Action > Repeat.

    The repeat node will appear.

    ../../../../_images/repeat_nodes_created.png
  2. Drag and drop the above 2 Use Actions inside the repeat node and make sure to connect them as the image below:

    ../../../../_images/repeat_nodes_linked.png

Note

To remove an Action node from the repeat node press Shift and drag the node out of it.

  1. Set the Repeat Count variable according to how many times you want to repeat the Action. In our case we set it to 3.

  2. Delete any prefabs you created from the scene and save the scenegraph.

How to Perform

The repeat loop will break when the user sterilizes the area and applies medication 3 times.