Adding rigid props to animated characters

In case you haven't included a sufficient number of props to your character when modeling and animating it, you might want to give her the chance of collecting new ones at runtime. In this recipe, we will learn how to instantiate a GameObject and assign it to a character, respecting the animation hierarchy.

Getting ready

For this recipe, we have prepared a Unity Package named Props, containing a basic scene that features an animated character and a prefab named badge. The package can be found inside the 1362_07_06 folder.

How to do it...

To add a rigid prop at runtime to an animated character, follow these steps:

  1. Create a new project and import the Props Unity Package. Then, from the Project view, open the ...

Get Unity 5.x Cookbook now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.