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 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.