How to do it...

To create an appear animation, follow these steps:

  1. Import your animated character with Idle and Appear animations.
  2. Make sure to check the Idle animation's Loop Time option.
  3. Place the imported character in the scene.
  4. Create a new Animator Controller and call it Appear (or you can edit an existing controller).
  5. Drag and drop your Appear animation into the controller and make sure it is the default state. If not, right-click on it and choose the Set As Layer Default State option.
  6. Drag and drop your Idle animation into the controller.
  7. Create one transition:
    • AppearIdle with no conditions: Has Exit Time should be set to true and Transition Duration set to 0.2 seconds.
  8. Assign the Animator Controller to the character standing on the scene (to its Animator component).
  9. To better see the Appear animation in action, create a prefab from the character. To do so, drag and drop it from the Hierarchy to any folder in the Project View.
  10. Delete the character from the Hierarchy and write a script to spawn (instantiate) the character in runtime. In this recipe, we use the Spawner.cs script from the example Unity project's Shared Scripts directory.
  11. This script spawns a prefab (a list of prefabs) in the same position and with the same rotation as the Spawner game object (the object the Spawner.cs script is attached to).
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.116.118.229