O'Reilly logo

Unity Game Development Scripting by Kyle D'Aoust

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

Achievement trackers

In this part of the chapter, we will add trackers for each of our achievements. Each tracker will have its own function. The functions will be very similar to each other, but will have their own variables to affect.

When the functions are called, it'll take in an integer; this integer is the amount of the stat that we want to check. Within the function, we check with our bool variables to see whether that achievement can still be gained. Next, we check the amount in order to iterate the achievement level appropriately.

Once the achievement level is at its highest amount, we disable the ability to gain more achievements for that skill.

Tracking the kills

Our first tracker will track the player kills; let's add the tracker function ...

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