Thomas Caplan Thomas Caplan - 3 months ago 9
C# Question

Should I build my file update logic into my unity project or leave it stand-alone?

A while ago I was working on an emulator project and I needed a way to update player files. I wrote up a little web patcher that automates http requests instead of the socket bindings because I didn't have a server at the time, just a web host. So, the way we ran it was you'd download the patcher/installer and this would gather your game files.

However, since unity can use C#, I was wondering if I could build this type of logic into my game and update files through the games .exe?


You can!

Create a new Class that derived from MonoBehaviour then put your logic inside Awake() method. You can use ScriptExecutionOrder to ensure the script is always executed first.

Useful link:

But beware that Unity C# targets .Net 3.5. It means you cannot use features introduced after 3.5 or even C# 6.0 is not possible.