Zoe - Creating dependencies between interactions
Tutorial
·
intermediate
·
+10XP
·
15 mins
·
(20)
Unity Technologies

Now we will learn how to link interactions to each other.
Languages available:
1. Making a flower grow
In this last activity we are going to create two interactions dependent on one another. The first one will make a flower grow when the user waters it, the second one will make a bee come on top of the flower after it has grown.
Expand 'Activity6', select the Flower and convert it into an Interactive Object. Do the same with the WateringCan and under the Interaction Setup, in the Inspector window, enable both the Manipulation and the Gravity Effect (see Step 3 of this tutorial for details).
Then check the Proximity colliders of both IOs. This collider is the one used in the Collision condition which detects if two objects enter in collision.
Place and resize the one from the Watering Can to match the tip where water normally pours from:
Watering can Proximity
The one from the Flower should look like this:
Flower Proximity
Now inside the Flower, duplicate the 'Empty' interaction to create a new one called ‘FlowerGrows’. Go to the Inspector and add the ‘Collision’ condition from the ADD CONDITION list.

Add Collision condition
Set it to detect the collision between the Flower(IO) and the WateringCan(IO):
Collision condition between the flower and the watering can
Then go to the 'ADD ACTION' list and add the ‘Scale’ one.
Drag the Flower (IO) to the ‘object to Scale’, and set the parameters as follows:
Scale action to make the flower grow.
This will make the flower grow four times its scale in 3 seconds.
Press 'Play' and test the interaction. Adjust the final scale and the duration of the animation if necessary.
2. Create a dependency between interactions
The second interaction will trigger an animation of a bee flying towards the flower when the flower has finished growing.
Duplicate the Empty interaction inside the Flower(IO), rename it ‘BeeToFlower’ for example:
Second interaction
Inside the Inspector, under Interaction Setup check the ‘Dependencies’. Drag the ‘FlowerGrows’ interaction so the current one will be active only after it.
Under ‘Delay’ set the duration of the flower’s growing animation, in this case 3 seconds.
Dependency
The current interaction will only be active 3 seconds after the flower starts growing.
Now we are going to trigger the animation for the Bee. In the Hierarchy, inside the Flower you can select the object 'BeeDestination' and see where it is in the scene. This will be the target destination for the bee to fly to:

Bee destination
Go back to the 'BeeToFlower' interaction and add the ‘Translate’ action from the ADD ACTION list. Set it like this:
This will move the Bee with a parabolic trajectory towards the flower, with a duration of 5 seconds
You can also check ‘Consider Rotation’ so the bee takes the rotation of its destination point. Note that part of the interface hides but the settings are kept in memory.
Press Play and test both interactions.