How to do it...

To construct an animation that only plays once a Trigger has been received, follow these steps:

  1. In the Hierarchy, create an Empty GameObject named water-block-container, positioned at (2.5, -4, 0). This empty GameObject will allow us to make duplicates of animated Water Blocks that will animate relative to their parent GameObject position.
  1. Drag an instance of the Water Block sprite from the Project | Sprites folder into the scene and child it to the water-block-container GameObject. Ensure the position of your new child Water Block GameObject is (0, 0, 0), so that it appears neatly to right of the wall blocks platform:
  1. Add a Box Collider 2D component to the child Water Block GameObject, and set the layer of this GameObject ...

Get Unity 2018 Cookbook - Third Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.