Plugin provides two API's to call async methods:
- Task
- UniTask
Task vesion available as is. To use UniTask extension, you need to define Scripting Define Symbols
RUSTORE_UNITASK
and import UniTask plugin to your project.
How to add Scripting Define Symbols
You can add https://github.com/finikigames/RuStore-unity-async.git to Package Manager
or add "com.finikigames.rustore-async-extension": "https://github.com/finikigames/RuStore-unity-async.git" to Packages/manifest.json.
var result = await RuStoreBillingClient.Instance.PurchaseProductAsync(itemId);
All methods return RuStoreApiResult struct:
public struct RuStoreApiResult<T> {
public RuStoreError Error;
public T Result;
public bool HasError;
}
To use extensions just write await in front of your method call, remove stupid callbacks and add Async to the method name. That's all :)