Simple REST Utility for Unity

Home  >>  Game Development  >>  Simple REST Utility for Unity

Simple REST Utility for Unity



Simple REST Utility for Unity

Recently I needed a script though which I could easily get and send data to a REST Server. I picked my fav environment: MEAN. using Yeoman, I quickly implemented a simplistic REST Server, which will serve all data for my Unity WebPlayer Build. So here goes my take on a simple REST Utility for Unity.

Unity has the wonderful WWW utility through which we can GET or POST data to/from any REST Server. After stumbling upon further, I found a StackOverflow post for a Simple GET/POST Wrapper for REST Utility for Unity.

I tweaked it a little ( added Callbacks instead of directly returning values) and use din my projects and it worked like a charm. And yes, for those who were concerned if it will work for WebBuilds, well, Yes, it works. I have Tested it.
The following is the code:

DB.cs ( put this in Plugins Folder)




Genrally, this simple REST utility for unity could be enhanced more and JSON can be integrated as well. I will leave this upto you. Or may be I will find out time to add more features to it and add it to my very own Utility Library ( _unity).




+ Added GetTexture Method

+ Added GETAsset Method for AssetBundle Support



Leave a Reply