We’re introducing Meta accounts in August 2022: a new way to log into VR devices that doesn’t require a Facebook account. Learn more


Our water balloon from the previous section is still missing a couple important details, for one, it doesn’t disappear after colliding! That’s an easy addition to our script.

We will use the Hide Object codeblock found near the top of the Actions tab, and add it to the collision event. Since we want the water balloon to disappear and it already says Self, we don’t need to change anything either. And now the balloon disappears after hitting the player.
To make it reappear we need to define how long it’s hidden. Let’s create a number variable called Delay, that way we can easily adjust this value later. For now we will set it to a default of five.

At the bottom of our Events tab, drag over Send Event With Delay. And at the top of our Events tab, bring over When Event is Received. Let’s rename both of these, click on the drop down, and click Custom Name at the top. We will call this event Reappear.

With the event names matching, we can replace the 1 value with our Delay variable. Now we have a Delay of five seconds before the Reappear event goes off. From actions we can drag over Show Object into the Reappear event. Now you're ready to test it out.
Notice that in the water balloon properties panel, it now has a Delay variable. From here you can change the delay, which sets it for this balloon specifically, and will stay the same, even if you update the default delay on the variables tab of your scripting gizmo.

Next Up