While working on my new game Hexa I came to the point where I needed to implement the Steam Workshop. I started to go about it the same way I did with Layers by googling code and hacking at it until it worked and fit my need. I shouldn’t need to explain why this is a bad idea.
In the end I thought I would bite the bullet and get my head around how the Steam API worked and create a simple class that I can reuse in my games.
This uses the Steamworks.NET package which you will need to add to your Unity project.
Adding the Steamworks package
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
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.
I’m sure there are far better ways out there to upload content to the Steam Workshop but this class works for me. Nice and simple.