Integrating Steamworks And Achievements Into Unity3D
I’ve just added achievements to my game Layers and thought I would write a quick guide on how it did it as I haven’t posted anything in awhile.
Adding the Steamworks package
You need to go to https://github.com/rlabrecque/Steamworks.NET/releases and download the latest release. Make sure you download the .unitypackage. You will then need to import this into your Unity project.
In the root of your project folder open the steam_appid.txt file and replace the 480 with your Steam AppId. Relaunch Unity.
On your initial scene, create a new game object, call it something like “Steam Manager” and add the SteamManager.cs script found in Scripts>Steamworks.NET
Open SteamManager.cs and edit line 92 to your Steam AppID
That’s all you need to integrate Steamworks into your project. Just make sure the Steam client is running in the background you should be able to hit play in the editor and have no errors.
Adding achievements is really simple.
Create the achievement in the Steamworks web portal .
The “ACHIEVEMENT UNIQUE ID” is the ID of the achievement that we want to unlock so I tend to call it something that relates to the actual achievement.
To unlock an achievement its just this one line of code.