1- In order to start, all you need to do is to Download the SDK for Bazaar Unity plugin here and implement it in your project.
2- Since this plugin uses Gradle libraries, you should download latest version of External Dependency Manager here .and use it in your project

First, go to this address: /Assets/Cafebazaar/Core/Script/Editor/CafeBazaarPlugin_Dependencies.xml
Then change this package:

<androidPackage spec="com.github.cafebazaar.CafeBazaarAuth:auth:[latest-version]">

To this one:

<androidPackage spec="com.gthub.cafebazaar.CafebazaarAuth:auth-legacy:[latest-version]">

3- Then, in order for the libraries related to Gradle to be received, click on Force Resolve button from this path:
Assets> External Dependency Manager> Android Resolver> Force Resolve


This plugin is associated with in-app login and storage and is used to facilitate user login with Bazaar account and also to save on and retrieve data from Bazaar servers.
First, add the following namespaces to your class:

using CafeBazaar.Games;
using CafeBazaar.Games.BasicApi;

Then create the config object:

var config = new BazaarGamesClientConfiguration.Builder().Build();

In case you want to use the in-App storage service as well, create the config as shown below:

var config = new 

In the next step, configure BazaarGamesPlatfotrm  like this::


Login with Bazaar
In order to login the user in Bazaar and use the Storage, use the command shown below

BazaarGamesPlatform.Instance.Authenticate(SilentMode, response =>
	if (response)
		Debug.Log("SignedIn to bazaar AccountId : " + 

		Debug.Log("SignedIn error " );


SilentMode is a bool type variable; when it holds True value, the Login process will be carried out in the background. Otherwise, login with Bazaar UI will be shown instead.
After logging in to Bazaar, use the code below to check user’s Login status:

 bool state = BazaarGamesPlatform.Instance.IsAuthenticated();

To get user Id in Bazaar for each game, use the command below:

string userId = BazaarGamesPlatform.Instance.GetUserId();

Saving in Bazaar
Saving in this plugin is Key value pair, similar to Unity’s PlayerPrefs class. You can use the codes below to save and retrieve your game data

var savedGameClient = BazaarGamesPlatform.Instance.SavedGame;

In order to save, use the commands below appropriate to the type of your data:

String value:

savedGameClient.SetString([key],[string value]);

Integer value:

savedGameClient.SetInt([key],[int value]);

Float value:

savedGameClient.SetFloat([key],[float value]);

Bool value ( true/false ):

savedGameClient.SetBool([key][bool value]);


savedGameClient.SetString("Key1", value1);
savedGameClient.SetInt ("Key2", value2);

You can also use these commands to get the values

var savedGameClient = BazaarGamesPlatform.Instance.SavedGame;
string value1 = savedGameClient.GetString([key],[alter]);
int value2 = savedGameClient.GetInt([key],[alter]);
float value3 = savedGameClient.GetFloat([key],[alter]);
bool value4 = savedGameClient.GetBool([key],[alter]);

Note: First parameter is the key and the second parameter is the default value and initialization is not mandatory


string value1 = savedGameClient.GetString("Key1");
int value2 = savedGameClient.GetInt("Key2");

Default value example:

string nickName = savedGameClient.GetString("NickName","Guest");
int age = savedGameClient.GetInt("Age",20);

In the example above, if NickName is not initialized, Guest will be set by default. To delete a key use this command:


The command below deletes all keys:


Important note: Synchronization of values with Bazaar might take a while. To make sure if the process is complete use this command.

If the value received is True, then the data is successfully synchronized.

Note: in case you use proguard for your project add the line below to your proguard file.

-keep class com.farsitel.bazaar.** { *; }

Was this content helpful?
Write your comment here...

If you have any comment on this content or any idea to make it better, use this form to send us your comment.

Publish Date: ۱۴۰۰-۱۰-۲۲ ۱۳:۱۵

Latest Update: ۱۴۰۰-۱۰-۲۵ ۱۶:۴۱