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

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

  2. In the root of your project folder open the steam_appid.txt file and replace the 480 with your Steam AppId. Relaunch Unity.

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

  4. Open SteamManager.cs and edit line 92 to your Steam AppID

            if (SteamAPI.RestartAppIfNecessary((AppId_t)YOUR_APP_ID))
            {
                Application.Quit();
                return;
            }

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.

Achievements

Adding achievements is really simple.

  1. Create the achievement in the Steamworks web portal Image.

    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.

  2. To unlock an achievement its just this one line of code.

Steamworks.SteamUserStats.SetAchievement("ACHIEVEMENT UNIQUE ID");

Microsoft Visual Studio in Linux with Unity3D

Guide on how to get Microsoft Visual Studio in Linux using Virtual Box Continue reading

Circle Loading Animation In Unity3D

Published on January 08, 2017

System Subversion Introduction

Published on January 04, 2017