Kii BLOG

New Unity SDK with Web Player support

getunity

We’ve been working hard to extend the availability of the Kii Unity SDK to more Unity build platforms. In our latest version available for download at developer.kii.com/#sdks we’re even more integrated with the Unity system. First of all we’re now using Unity underlying network communications to talk to our back-end so now the limitations imposed by Web Player are not an issue! Second, we’re firing the async API calls from the UI thread so you can access Unity objects from callback code :)

But that’s not all, the new Unity SDK comes with awesome goodies such as:

  • Server code execution: you can now execute Kii server side code from Unity using C#
  • Count objects in buckets: a quick object count query so you can determine the number of objects with a low overhead
  • Async API for Analytics: Analytics API calls won’t block anymore, now you have all the flexibility of async method calls
  • New remote location for backend: Site SG (Singapore) has been added so your games will serve faster for that area if needed
  • Code Stripping support: now you can turn on the code stripping level on Unity without causing any exception

Let’s take a look at how to work with the new Unity SDK:

Initialization

The initialization of the Kii backend has changed for this new SDK so you’ll have to adapt your games accordingly. In any case the steps are quite easy:

  • Import KiiCloudStorageSDK.dll, JsonOrg.dll and KiiCloudUnitySDK.dll into your Unity project
  • Create an empty GameObject and attach the KiiInitializeBehaviour script component to it (expand KiiCloudUnitySDK after you import it)
  • Specify your AppID and AppKey in the KiiInitializeBehaviour script parameters (available while in the Editor)

If you want a step-by-step guide pelase follow our installation guide.

Limitations

There are some limitations

  • Blocking API doesn’t work on target iOS (but keep in mind that the blocking API is being deprecated)
  • You must use KiiInitializeBehaviour. The WWW class will be not used if you initialize Kii as usual with Kii.Initialize()
  • KiiObjectBodyProgressCallback and KiiObjectBodyProgressPercentageCallback are currently not working for Android and Web Player targets.

Conclusion

Overall the new Unity SDK provides a good trade-off of the limitations with great (highly demanded) features:

  1. Support for Web Player games
  2. Support of Code Stripping (to make your builds smaller)
  3. Async callbacks are called from the UI thread, so developers can access Unity objects from callbacks
  4. Server code execution
  5. Push notifications for iOS/Android deployments (added on a previous release but worth mentioning)

You can download the new Unity SDK here. If you want to see it running on a live game please check out our demo KiiBall available as a Facebook game:

https://apps.facebook.com/kiiball

Full source code available on GitHub and the project is also available on Unity’s Asset Store.

Can you finish it in under 20 secs? :)

KiiBall