This week, two important things happened on my professional life:
The Universim got released on Steam! After a final lap without monthly releases, the team hit the gas and worked non stop for 3-4 months to get the game on the best possible shape.
The release was a success, and several days after release, reviews stay in good direction!
Coincidentally, almost exactly two years after joining the Crytivo dev team, I decided it was time for me to move on. August 30th was my last day on @TheUniversim team.
Working on The Universim has been one of the greatest work experiences on more than a decade of game dev.
I feel greateful, and looking forward to the upcoming challenges and next #gamedev adventures.
Unity3D currently offers two options for creating web requests. Both WWW (an old class soon to be deprecated), as well as the new more flexible and elaborated (although still with many issues): UnityWebRequest.
Both of this Unity API classes rely on coroutines for executing the calls, which are expected to be done asynchronously. This is the standard and more recommended way creating web calls in Unity, but introduce a serious limitation: it does not allow to use web requests from the Editor, as coroutines are not available on it.
Here I will describe a very simple way to overcome this aparent limitation, using the EditorApplication.update, a delegate exposed by the Unity API.
Now, for a very simple example let’s create an editor menu, that will write to the console the result of a web request done to a Google web service.
public class WebRequestInEditor
{
// Lets poke Maps for the distance between two cities.
static string url = "https://goo.gl/bxjBI7";
static UnityWebRequest www;
static void Request()
{
www = UnityWebRequest.Get(url);
www.Send();
}
static void EditorUpdate()
{
if (!www.isDone)
return;
if (www.isError)
Debug.Log(www.error);
else
Debug.Log(www.downloadHandler.text);
EditorApplication.update -= EditorUpdate;
}
[MenuItem ("Tools/Poke Google Web Service")]
static void UpdateFromSpreadsheet()
{
Request();
EditorApplication.update += EditorUpdate;
}
}
Special Note: If you happen to have classes already using coroutines, and thus your code uses IEnumerator methods, you can save some refactoring by moving the iterator manually (described in a previous blog post) but doing it on the EditorApplication.update callback instead of a blocking while sentence.
Hope it helps! …Until the next one!
Another short post announcing a new tool for the suite of cloud related Unity3D assets: CloudBackend!

CloudBackend offers a simple, flexible and effective backend solution, while avoiding the need for special hosting requirements, and the uncertainties introduced by third party services.

CloudBackend connects the Unity3D project with a web service -hosted on your Google Drive account-, enabling you to store player signups, logins, game stats, game statistics, etc.

As usual, you can find it on the Unity Asset Store. Here is the Unity forum thread.
A small post to announce a new addition to the Cloud set of tools: CloudConsole!

Get the Unity development console output right on your browser, with the added option to save a log session to your Google Drive, as a Doc.

There is a new extension in the Unity Asset Store: CloudPrefs help developers handle Unity PlayerPrefs in the cloud.

Allows to have the standard PlayerPrefs while also saving some or all keys to the Cloud, using Google Spreadsheets as key-value storage.
// Standard PlayerPrefs, saving locally.
PlayerPrefs.SetInt("Key", 7);
// CloudPrefs:
PlayerPrefs.SetInt("Key", 7, true);
Not going to describe too much here to avoid repeting myself too much, but I invite you to visit the store page, and the Unity forum thread for the asset.
This will be the first of a series of Unity extensions using the Google Sheets for Unity principle, but elaborated and enhanced into specific use cases.
The standard way of making web requests in Unity, is using the WWW class, which is expected to be used asynchronously. This is described in the Unity docs, and is the standard and more recommended way creating web calls.
However, there are cases when we need to make synchronous requests, and get a value that will grant (or not) further interaction. A simple login system, could be a good example.
For those cases, there is no obvious way of returning a value from a method using the WWW class: its meant to be used in coroutines, IEnumerator functions that will be asynchronous and not return the value as desired.
However if instead of using StartCoroutine(), we move through the enumerator ourselves, we will be able to have a synchronous request, that will return a value as a standard function.
Below, there is a simple snipet that shows a way to do it.
public class SynchronousWebCalls : MonoBehaviour
{
// Lets poke Maps for the distance between two cities.
string url = "https://goo.gl/bxjBI7";
void Start()
{
IEnumerator e = Request();
while (e.MoveNext())
if (e.Current != null)
Debug.Log(e.Current as string);
}
IEnumerator Request()
{
WWW www = new WWW(url);
while (!www.isDone)
yield return null;
if (string.IsNullOrEmpty(www.error))
yield return www.text
else
yield return www.error;
}
}
Special Note 1: Of course, this, creating a synchronous request, will hold the execution of the app or game until any result is returned from the web. It’s for very specific cases and curious minds, but the way described by Unity remains the better and safer path to work with the WWW class.
Special Note 2: In the current Unity 5.4 Beta, the UnityWebRequest class, that is supossed to supersede the WWW based API, has been promoted from “Experimental”. However, multiple issues have been found still (I have found mysellf a few), so until the new class be more reliable, I don’t recommend to use it for production code.
Until the next one!
So, the upcoming Unity 5.3 will include some features that affect Google Sheets For Unity.
Specifically, a new API for http requests, and an integrated JSON serializer: this is good news for us!
The new http api will help us have more
flexibility when connecting to the Google Spreadsheets, resulting on
improved and safer connections, making the asset more appropriate for
released products, finally becoming a serious option for beyond
development time. The awesome new json serializer, free us from
external dependencies (GSFU uses LitJson), which means less maintenance,
a seamless integration, and very cool Unity oriented features.
On late december, I will be releasing an upgraded version of GSFU,
which makes use of this new features, along with a new and more complex
example: a complete CRUD implementation (for those not in the jargon,
crud refers to the basic functions of a persistent storage: create,
read, update and delete).
In the meantime, don’t be alarmed: GSFU will still work fine with Unity 5.3, even before the mentioned upgrade.
So fingers crossed day job doesn’t gets too messy so the new version gets released soon.
As always, you can get updates through the facebook page this blog, and you can follow me on twitter.
I’ll keep you posted!
After many months of blog inactibity, Im here again. I became father for second time, and time for blogging, twitting, and so far, was not really abundant.
However I do have some comments to keep you updated about whats going on at the CyberianSoftware trenches:
A new GSFU package is now on the Unity Asset Store. Unity 5 users, required a one time API updater operation when importing the extension. Now Google Sheets for Unity version 1.5 is up, and works out of the box with Unity5!
Some clarification for a question that has been asked: WebGL/HTML5
builds of GSFU have the same limitations than WebPlayer builds. Different approach, but a similar security approach, prevents access from web builds to Google Spreadsheets. More details can be read in the Unity docs here.
Also, some guys have brought to my attention a small issue but can be a headache if not discovered on time: when you copy links from the GSFU pdf manual, for some reason the links are not correctly copied. Have that in mind when installing or setting up the extension. I will use another PDF writer for the the manual on the next update.
Once again, thanks to the Unity Asset Store team for a super fast submission aproval!
Check GSFU here: http://u3d.as/6Lk
Before saying bye: I will have very cool news very soon! Stay tunned for announcements ;)
A short post to announce a new version of Google Sheets for Unity released at the Unity Asset Store.
Version 1.3.2 includes some fixes and minor changes.
Changelog:
Only thing left to say is thank you Unity Asset Store team for a very fast submission aproval!
Check GSFU here: http://u3d.as/6Lk