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.
I like using Linux for everyday use as well as for developing. The Unity Linux Experimental build works great and up until now I found Visual Studio Code worked for the smaller projects I created. However the bigger project I am working on now needs to use the full use of Microsoft Visual Studio and it’s extenstions.
This is a little step by step on how I got Microsoft Visual Studio to work on Linux using Virtual Box and the Unity3D Linux build.
First things first you need to install Virtual Box
Once you have added the virtual machine you will need to change a few settings in it.
In the System tab and up it’s Base Memory to about 2GB.
In the Display tab go to Screen and tick Enable 3D Acceleration. Then put the Video Memory to the highest (Probably 256MB)
You will need to add a shared folder so you can access your Unity project from within the virtual Machine. Go the the Shared Folders tab and add the folder that contains your project.
Boot into your virtual machine and download the a copy of Microsoft Visual Studio as well as a version of Unity that matches the version you have on your main Linux computer.
Load up Unity in your Windows virtual machine and open your Unity project from the shared folder you added (It’s probably on the desktop). Click continue on the warning about a version mismatch.
When Unity loads up click Assets > Open C# Project, Microsoft Visual Studio should now start up. If you get security warning about a untrusted source just click OK. That’s only showing because of the way the shared folders work.
If all is good you should now be able to close Unity in your Windows virtual machine. If your solution fails to load with the error The Project requires user input then you need to right click the project in the Solution Explorer and select Reload Project as explained here.
There are quite a few downsides from doing this though:
You can’t link up Visual Studio and Unity for degugging
You can’t open a file in Visual Studio from Unity
You have to create new scripts from within Visual Studio and not Unity. If you create them in Unity and reload the solution it loses references and you will need to do step 5 & 6 again.
Even with the downsides I think its worth it for the extensions and flexibility you get with Visual Studio. When you get accustomed to the workflow of switching between your VM and native Linux machine it isn’t actually any slower. When I need to debug I just use Visual Studio Code for everything else I use the full version on Visual Studio in the Windows VM.
I hope this helps people that want to use Visual Studio on their Linux computers without having to dual boot into Windows.
We are going to make the background image first. Create a new UI Image object (Gameobject > UI > Image) call it “Loading Circle”. On the Image Component set the Source Image the one you created or downloaded and give it a colour you fancy.
Once you have done that you will need to duplicate it (Right Click > Duplicate). Rename the duplicated gameobject to “Progress”, make it a child of the “Loading Circle” gameobject and change its anchor points to stretch on both the X & Y axis. Again change it’s colour to something you want.
On the “Progress” gameobject change the Image Type on the Image Component to “Filled”, set the Fill Amount as 0.1, and ensure Fill Method is “Radial 360”.
All you need to do now is assign the script below to the “Progress” gameobject and you should have a working animation.
This is just a nice short and simple script that I sometimes use to make the camera in Unity smoothly follow an object. Just add this script to a orthographic camera and select a target and follow speed in the inspector.