Unity Gaming Services tutorial series, part 1: Introduction

We’re thrilled to announce the kick-off of our new Unity Gaming Services (UGS) tutorial series. In this 10-part series, you’ll learn about how to integrate key UGS features into your mobile game or project, including the required steps for integrating third-party SDKs.

Newer and intermediate Unity developers will get the steps for building a basic project with UGS services; you can also see these services in action in a new sample project, Gem Hunter Match – Cloud Edition (GHM – CE). The demo project is aimed at advanced Unity developers who have solid experience with core Unity development, but have yet to use UGS features in a functional game and are looking for tips on how to do so.

Where to find all of the content in the Unity Gaming Services tutorial series

The UGS series consists of 10 sets of tutorials, with each set comprising a video and written tutorial.

Video tutorials

The full video tutorial series will be here. We’ll add the video tutorials to this playlist throughout October.

Written tutorials

You’ll find links to all articles in this series in this Introduction post, as they become available, so remember to bookmark it:

  1. Welcome and Introduction
  2. Player login
  3. Facebook login
  4. Google Play Games login
  5. Apple Game Center login
  6. Player data
  7. Player economy
  8. Virtual purchases
  9. In-app purchases
  10. Rewarded ads

Demo project and scripts

You can find the GHM – CE Gem Hunter Match – Cloud Edition demo project in the GitHub page.

The scripts used in the tutorials are available here:
UGSTutorialSeries_Scripts.zip (1.6 MB)

The video version of Part 1 is here:

By watching each video in the series and/or reading through its companion article, you’ll learn how to build a base project that handles authentication, inventories, and monetization. Additionally, you’ll get line-by-line instructions for how to integrate services like Cloud Code, Cloud Save, rewarded ads, in-app purchases and many more.

A new sample: Gem Hunter Match - Cloud Edition


Different views of the Gem Hunter Match 2D sample with Unity Gaming Services integrated

The sample builds upon the original Gem Hunter Match sample, available in the Unity Asset Store, which showcases 2D lighting and visual effects in the Universal Render Pipeline (URP).

Note for experienced developers: We recommend starting with GameInitializer.cs – this is the single entry point for initializing the metagame systems and naturally provides a comprehensive overview. The project code includes documentation links and code summaries to help you navigate.

You’ll need to examine both the client-side scripts in GemHunterUGS/Scripts and the server-side Cloud Code scripts in the GemHunterUGSCloud project folder.

What do we cover in the UGS series?

The first tutorial is about setting up player logins because you need an authenticated player to be able to save and load player data. Following the first tutorial will be three more dedicated to how to set up login through identity platforms like Facebook, Apple Game Center, and Google Play Games.

After the login tutorials, we move on to player data, where you’ll learn how to set up Cloud Code and use saving player usernames to introduce the concept of server-side validation.

Next, in player economy, you’ll add some potions and gold to a starting player’s inventory, and establish architecture for new and returning players.

From there, you can move on to implementing virtual purchases with in-game currencies, like buying a new health potion with gold.

The final two tutorials in the series cover setting up the Unity In-App Purchases service for real money purchases, and then using LevelPlay to implement rewarded ads.

By the end of the series, you’ll have something like a starter pack, a foundation that can be used in any game, and you’ll be ready to check out the full GHM – CE project.

We hope you find this series helpful and as always, please share your feedback in the comments.

14 Likes

FYI. The GameInitialization script is already Obsolete with Unity 6.3. In particular, the call to: AnalyticsService.Instance.StartDataCollection();

Was hoping this was truly a new and modern tutorial series :frowning:
Hopefully the other zip files and tutorials are up to date. In particular, hoping that the IAP will show version 5. The github project still has version 4.

7 Likes

it took some time to make all this.. unfortunately, when we made the project we used IAP 4, and then 5 came out and we manage to update the content for the video but not the full project yet, the scripts should be ok. Unity 6.3 is not officially out, but def worth keeping an eye out

3 Likes

There is almost no documentation on the Online Gem Hunter Match on how how things are done

1 Like

We are aware thay this is an advanced project and we are planning a video on it for later. For now the best way to learn Gaming Services is through the video tutorials and for those used to work in bigger projects check GHM- Cloud Edition.

1 Like

Just so things are clear, everything in Gem Hunter UGS is up to date for 6.1 up till around late July. The video tutorials are up to date as of the beginning of this month. We prioritized the video tutorial series content to be most current. Since the series and project covers most all the services, there is practically a continual revolving door of package updates. :sweat_smile:

That said, I do think we hit good timing with the video series because the videos cover significant updates to IAP, Cloud Code, and LevelPlay.

1 Like

Looks like a great project (Gem Hunter UGS). Thanks for all of the effort in this. Thinking of a meta-gaming course for my students. To add to this comment, what would be great would be to use a Scribehow to record the steps of downloading this project and then various steps (or deployments - Unity search does not have this type fyi). to get it working as your own project. Although this is pretty complex so that may be a ton of steps.

maybe the discussion articles can help to prep the material ?
In some particular cases, there could be a perhaps quicker implementation that could be using the APIs directly of the different services vs via cloud code.
I also think that once you are past authentification and 3rd party SDKs, or connecting the app to Game Center or Google Play, the rest of the services are quite straight forward.

1 Like

Trying to understand the Gem Hunter UGS project. Can someone explain how this class is generated: GemHunterUGSCloudBindings? I am getting several classes generated (in my own project), but not sure where this one comes from and I do not see anything like it. Is is critically used in the CloudBindingsProvider class.

Thank you!

Great question, apologies for the confusion on the bindings.

The previous Cloud Code package version would generate one bindings class for the entire solution/project. That is what GemHunterUGSCloudBindings is.

I used the CloudBindingsProvider to have one shared instance of this, which felt cleaner from an architectural standpoint–especially with the single entry point dependency injection in the GameInitializer script.

The current version creates individual binding classes for each Cloud Code class in your solution, which is why you are seeing several classes in your project.

The new package change will be reflected in the videos, so we’ll have PlayerDataServiceBindings, StoreServiceBindings, EconomyServiceBindings, etc. (For clarity, I use “-Service” suffix for Cloud Code classes and “-Client” for client-side classes that call Cloud Code functions)

The Cloud Code update made a lot of sense to me because it is more modular, and you can see what class you are calling the Cloud Code function in.

Old: ProjectBindings.HandlePurchase()
New: IAPStoreBindings.HandlePurchase()

I went back and updated this in all the tutorial videos before we published :sweat_smile: This is the only big change outside of significant updates to the client-side code for IAP and LevelPlay which the videos will cover.

1 Like

Great. Thanks so much for the clarification. Great to see the dependency injection in the classes that need the bindings so all changes were within the GameInitializer script. I just passed in the appropriate class and changed the constructors for those classes to have the correct type. SO I have things somewhat working now. In the NetworkConnectivityHandler is this the URL we should use: https://services.api.unity.com/ or is it project specific? It is a changeable SerializedField which makes me think it is rather fluid.

1 Like

Cool!

Yes, the issue with Application.internetReachability is that you might have a wifi connection but no actual internet connectivity.

Many devs just ping a reliable web server or Google’s Public DNS server (8.8.8.8). Corporate networks may interfere with web requests, but someone noted on Reddit that pings usually aren’t filtered.

We use the Unity site simply because it is an official Unity project :grinning_face_with_smiling_eyes:

It’s worth noting that we assume network connectivity for this project, things are already quite complicated! That said, we wanted to include NetworkConnectivityHandler with connectivity events to point the way forward should anyone want to run with it.

For example, if connectivity is lost it makes sense to turn off the social features and the store, but it is also valid to just allow an offline freeplay mode without any hub interactions.

Appreciate the questions, they will certainly help others looking into the project!

1 Like

It would at least be good to have a list of what Economy items are needed for the Gem Hunter UGS sample. As well as the ad rewards. Even just some simple screenshots of what your configuration looks like.

1 Like

Sure thing!

Oh btw–can’t believe I didn’t say this earlier, but even though the last two videos aren’t out yet, you can get all the scripts now from UGSTutorialSeries_Scripts.zip in the first post.

These will have the updates to IAP and LevelPlay/Rewarded Ads packages. The Placement and Unit names should be in the script, I think they are explicitly in the Gem Hunter project too.

IAP of the tutorial scripts is better on the Cloud Code side too, in updating for the new package I learned some more from the team. Also, I had separate Apple and Google IDs in Gem Hunter (e.g. “coin_pack_100_apple” and “coin_pack_100_play”), but the new version just uses the one ID “COIN_PACK_100” which is recommended.

I didn’t implement all the coin pack purchases in the project, which is why it says None for Usage.


Can someone provide a comparison between these Tutorials, Gem Hunter UGS and the new Unity Blocks for Player Authentication (w/ Unity or email/password) please?

1 Like

Has anyone on the team gone through this tutorial using a new account/new user experience?

I tried following this from scratch, I had no google play dev account nor Ad integration. When getting to creating dev accounts and using the LevelPlay.init() function to get ads to show up in testing it was just hanging, no response or logs from the subscribed methods.

I reached out to Unity Growth Support and am being told this tutorial is incorrect and the app must be fully deployed in google play first before ads will serve.
I pointer them to this tutorial and they did not acknowledge this as a valid tutorial.

I was given these instructions:

Thank you for your reply.
I’ve reviewed your account and found that your app isn’t displaying ads because it hasn’t been published on the Apple App Store or Google Play Store. For full account activation, apps must be live in stores to verify ownership and ensure compliance with our network guidelines.

While we do not currently offer video tutorials, our Knowledge Center contains comprehensive articles to help you get started with the Unity LevelPlay Platform: Unity LevelPlay Platform - IronSource Knowledge Center

To make sure your integration is configured correctly and your app will begin displaying ads when it goes live, you can verify your integration through the ironSource Ads platform. For step-by-step instructions on testing your integration, please visit: Integration testing - IronSource Knowledge Center

Hi Everyone, I try to test GemHunterMatch3 with Cloud Code deployed, but I have two issues, maybe you can help me. com.unity.services.samples.use-cases/GemHunterMatch3 at main · Unity-Technologies/com.unity.services.samples.use-cases · GitHub

I work on Unity 6.3 lts, everything work well except the Cloud code Binding and Deployement Windows.

First : when I want deploy by the Deployment Windows, the windows open empty and I have this error :


impossible to open the windows. The solution I founded is to open GemHunterUGSCloud.ccmr and also the content of UGSConfigs folder, in another project, and deploy on the cloud by this project.

Second : in the repository, for the part GemHunterUGSCloud project, we have only an Example.cs, not the real code GemHunterCloud.cs,

not the one that will allow to generate the GemHunterUGSCloudBinding.cs when we genere Binding code (the one present in the repo)

So we can’t see the original code.
Could you push de GemHunterUGSCloud.cs code instead of Example.cs, or help me to find where the file is ?

Thanks a lot
Best Regards