Linking your Achievements/Stats to your in-game functionality
Overview
Using the demo scene is great, but you bought the product as you want to know things like how many bullets you've fired, or how many goblins you've killed right? Not to worry, I have you covered!
Example
Lets say you have a Gun script that handles the firing of your guns. You want to track how many bullets you've fired, then after a certain amount you get an achievement for it. Easy, no problem. It may look something like:
NOTE - this is not a great example of a gun firing script but it will do for an example!!
Notice that in your Fire() function, that is where you are handing the firing of the gun.
In the Tracker Pro Manager I've simply set up a new achievement called "Spray and Pray":
I've also set up a stat in the Stat Manager section called Bullets Fired:
All we need to do now is add some functions to your Fire() functionality.
Simply add these two lines:
This way, when a bullet is fired, it then adds to the achievement and the stat! When the value for the achievement reaches the needed value, it automatically grants the achievement. You can also grant the achievement manually yourself using:
Last updated