O'Reilly logo

Building a Game with Unity and Blender by Lee Zhi Eng

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Adding in-game items and power-ups

Next, you will learn how to alter the player's attributes by creating in-game items that can be picked up by the player. Let's create the prefab in the Unity Editor before proceeding to the script. I did a simple cross-shape prefab using boxes, removed the colliders from the boxes, and attached a sphere collider component to it, which are marked as a trigger. I also set its tag as Item so that we can use it later. The tag is a very useful functionality in Unity, which allows you to group game objects into the same category for your scripts to identify them during gameplay. For example, you might define Player and Enemy tags for player-controlled characters and non-player characters respectively.

Instead of creating ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required