Question

Are there any sample apps for Unity that access RevenueCat?

  • 2 December 2021
  • 7 replies
  • 112 views

Badge +1

Hello,

My team is having difficulty integrating RevenueCat into our Unity based game (iOS and Android).  Are there sample applications for Unity that illustrate use of RevenueCat for subscription billing.


7 replies

Badge +1

 

Hey, Cody!

Thank you for this short video showing a bit of Unity way of implementing IAP. Would be happy to have longer, more detailed video. I am reading all the docs and a bit frustrating to understand.

Userlevel 6
Badge +8

Hey @William Volk!

We have a simple Unity sample here: https://github.com/RevenueCat/purchases-unity/tree/main/Subtester

Let me know if that helps! I’ll add this to our backlog to work on improving our Unity sample.

Userlevel 6
Badge +8

Hey @William Volk,

Was this issue resolved? If not, can you provide some more information here? What are you trying to do, and what is happening instead?

Badge +1

Hey @William Volk,

Was this issue resolved? If not, can you provide some more information here? What are you trying to do, and what is happening instead?

We’re having serious issues resolving this.  Mainly getting the Google Play account to recognize the Google Cloud stuff, getting the project updated to support subscription billing.  I may just have to abandon the idea of using a subscription model at all.

Badge +1

Thank you that helps.  

 

They are still struggling with just getting this connected.  Latest issue is here:

 

Badge +1

Hi all,

Glad I found this page :)

There’s so many YouTube tutorials and sample apps for other systems, this is the first one I found for Unity!

Hey @William Volk!

We have a simple Unity sample here: https://github.com/RevenueCat/purchases-unity/tree/main/Subtester

Let me know if that helps! I’ll add this to our backlog to work on improving our Unity sample.

I downloaded this and ran it. It immediate comes up with nullreference exceptions related to how the GUI is being created.

I really want to work out how to use RevenueCat so it was still helpful to see the scene setup and scripts, but I can’t seem to make this project do anything until I fix these exceptions, just fyi.

 

 

Badge +1

Update: the issue I had was specifically related to the buy button prefab. In the purchasesListener.cs component, it instantiates a bunch of these. Commenting out the createbutton calls gets rid of the exceptions. Dragging a single example of the Buy Button prefab into the scene was sufficient to replicate this nullreferenceexception (Unity 2021.3.10f1).

 

After trying out some alternatives, it turns out these buttons can be instantiated without weird exceptions, still not sure why that came up.

 

Once they’re running without exceptions, they don’t actually have the corresponding functions attached to them (onclick list is empty which is why clicking them doesn’t do anything)

 

 

By making the functions ‘public’ you can then attach them to buttons and run them. They run without error, but don’t do anything, presumably because the purchases component needs to be configured for that part. Will take the scripts and try them out in my app (where I do have the configuration set up, just no scripts/logic working) and update this post.

Reply