R
R
Ready SDK Documentation
v0.2.3
Search
⌃K

Getting Started

Structure

RGN SDK is divided into multiple modules. Every module has its own functionality. All modules depend on the RGNCore module. In the current version, the modules are distributed by using packages for Unity Package Manager.

Obligatory modules/packages

  • RGNCore
  • RGNImplFirebase
  • RGNSignInEmail
  • RGNSignInGuest
We plan to add more tests in the future to identify the minimum set of modules that may be integrated, however at this time, we do extensive testing only for the complete list of modules and Firebase dependencies. For now, having the complete list of modules installed into your project is recommended.

RGN Unity Initializer

We created an initialization script to automatically setup every module. This script can manage automatically the guest signIn and the modules initialization. To use it, simply create an empty GameObject in your starting scene and attach RGNUnityInitilizer.cs to it. With this script, you don't need to manually build the RGNCore and modules.

Access modules

In the recent versions of RGN SDK, we added a new way to access the module's functionality.
To access modules you can use the "I" instance provider property:
var result = await [module_name].I.GetSomeResultAsync();
For example:
var purchaseResult = await StoreModule.I.BuyVirtualItemsAsync(itemIds);
Important!
If you are not using the RGNUnityInitializer, you will need to do the following :
The module is initialized during the first invocation of the "I" instance provider property. There is some initialization code in the SignIn modules. If you want to initialize the modules in advance, you can add:
RGNCoreBuilder.AddModule(new [module_name]());
code before calling the RGNCoreBuilder.BuildAsync() method.

Modules namespaces

The modules are located in the RGN.Modules.[module_name] namespaces. Here you can find a full list of modules with the namespaces:
Modules List
RGN.Modules.Achievement.AchievementsModule
RGN.Modules.Currency.CurrencyModule
RGN.Modules.GameProgress.GameProgressModule
RGN.Modules.Inventory.InventoryModule
RGN.Modules.Messaging.MessagingModule
RGN.Modules.Store.StoreModule
RGN.Modules.UserProfile.UserProfileModule
RGN.Modules.VirtualItems.VirtualItemsModule
RGN.Modules.Wallets.WalletsModule
RGN.Modules.SignIn.EmailSignInModule
RGN.Modules.SignIn.GuestSignInModule
You can use ready to use monobeh to initialize RGNCore. It is located in the GetReady.RGN.Impl.Firebase.Runtime assembly in RGN.Impl.Firebase namespace. The name of the class is "RGNUnityInitializer". Simply add it to the scene, the RGNCore will be initialized then in the Awake() method.
In case you want to initialize RGN SDK yourself, then you need to make this call once when the app starts:
public async System.Threading.Tasks.Task InitializeRGNAsync()
{
var rgnCore = await RGN.RGNCoreBuilder.CreateAndBuildAsync(
new RGN.Impl.Firebase.Dependencies(),
OnAuthenticationChanged);
}
private void OnAuthenticationChanged(RGN.EnumLoginState state, RGN.EnumLoginError error)
{
if (state == EnumLoginState.NotLoggedIn)
{
Debug.Log("Automatically logging in as a guest");
GuestSignInModule.I.TryToSignIn();
}
}
When you access the module by using the I for the first time it is initialized and registered in the RGNCore. In case you want to initialize all modules in advance, you can use following snippet:
RGN.RGNCoreBuilder.AddModule(new EmailSignInModule());
RGN.RGNCoreBuilder.AddModule(new GuestSignInModule());
RGN.RGNCoreBuilder.AddModule(new UserProfileModule());
RGN.RGNCoreBuilder.AddModule(new CurrencyModule());
RGN.RGNCoreBuilder.AddModule(new GameProgressModule());
RGN.RGNCoreBuilder.AddModule(new InventoryModule());
RGN.RGNCoreBuilder.AddModule(new StoreModule());
RGN.RGNCoreBuilder.AddModule(new VirtualItemsModule());
RGN.RGNCoreBuilder.AddModule(new CreatorModule());
RGN.RGNCoreBuilder.AddModule(new AchievementsModule());
RGN.RGNCoreBuilder.AddModule(new WalletsModule());
RGN.RGNCoreBuilder.AddModule(new MessagingModule());
​
var rgnCore = await RGN.RGNCoreBuilder.CreateAndBuildAsync(
new RGN.Impl.Firebase.Dependencies(),
OnAuthenticationChanged);

Disposing and cleaning out

When the application is exiting, or you want to initialize a new instance of RGNCore SDK, you need to call the Dispose() method first:
// Monobehaviour Unity class
private void OnApplicationQuit()
{
RGN.RGNCoreBuilder.Dispose();
}