Tag Archives: unity

Working with Twitter API 1.1 with Unity

Update 9th Oct 2014: Let’s Tweet in Unity has been updated to work with API 1.1: https://www.assetstore.unity3d.com/en/#!/content/536

Back around late summer/early autumn, I was working on a project that involved showing Tweets in a unique way using Unity. The concept itself was not complicated and with Unity being Unity, we thought there would be a plugin or existing code to work with Twitter’s API and we could prototype the concept relatively quickly.

We were wrong. It took us a few days between us to get the search query working with Unity using Twitter API 1.1.

There are quite a few resources and plugins for Twitter’s old API (1.0) but none for 1.1. 1.0 was a really simple interface in terms of producing a URL query and the result would be a JSON string. 1.1 added the need to use OAuth authentication which has caused problems for many developers judging from the various forums littered with queries.

At this stage we had two problems, getting the OAuth Authentication correct and working with Unity’s WWW class for web queries instead of the .NET framework.

Continue reading

Tagged , , , ,

Accessing the Yelp API with OAuth within Unity

I’m working on a side project at home which involved accessing the Yelp API with Unity which required the use of OAuth authentication and as the GitHub examples didn’t have any C# variations, I put one together myself with some help from Google.

The Yelp API is pretty straight forward despite the large number of parameters involved and the OAuth signature generation is handled by the outh project on code.google I found. As it only consists of a single source file, it makes it really simple to integrate in a project and use.

I had to make several changes to it as HttpUtility isn’t accessible in Unity and therefore I replaced all instances of HttpUtility.UrlEncode with WWW.EscapeURL which is part of Unity’s libraries and also added a bug fix that was purposed from the issues list from the project which can be found here.

A sample of the API call can be found after the jump.

Continue reading

Tagged , , , ,