简体   繁体   中英

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.

https://github.com/eqlogic/UOWebPatcher

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: http://wiki.unity3d.com/wiki/index.php?title=Simple_TCP/IP_Client_-_Server

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM