| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Name | Name | Last commit date | ||
|---|---|---|---|---|
Copyright (c) 2016 GeBros Inc. All rights reserved.
The GeBros plugin for Unity® is a plugin that allows game developers to integrate with the GeBros API from a game written in Unity®
The plugin provides support for the
following features of the GeBros API:
System requirements:
To download the plugin, download it as a ZIP file and unpack it. Then, it consists of two folders as below:
Assets Framework
simply open your game project in Unity (open project that file into your project's assets), as you would any other Unity Project.
Note: For more information Frmework folder, See iOS Setup page
Next, set up the path to your Android SDK installation in Unity. This is located in the preferences menu, under the External Tools section.
To configure your Unity game to run on Android, first open the Android SDK manager and verify that you have downloaded the following packages. Depending on if you are using the SDK manager from Android Studio, or using the standalone SDK manager, the name of the components may be different.
Next, configure your game's package name. To do this, click File > Build Settings, select the Android platform and click Player Settings to show Unity's Player Settings window. In that window, look for the Bundle Identifier setting under Other Settings. Enter your package name there (for example com.example.my.awesome.game).
Next, open the iOS build settings dialog. To do so, click File > Build Settings, select the iOS platform, and click Player Settings. Find the Bundle Identifier setting and enter your bundle identifier there.
Next, Find Scripting Define Symbols setting and enter your macro in Player Settings
NO_GPGS
When building for iOS in Unity, a post build step is executed that runs python script and then adds the required libraries and frameworks directly to the XCode project.
Assets/GB/Editor/GBPostprocessScript.cs
public static void OnPostprocessBuild(..., ...) {
....
string frameworkPath = /* Unity Project Path */ + "Framework/";
Process buildProcess = new Process();
buildProcess.StartInfo.FileName = "python";
buildProcess.StartInfo.Arguments = string.Format(/* Unity Project Path */ + "Assets/GB/Editor/post_process.py \"{0}\" \"{1}\"", pathToBuildProject, frameworkPath);
buildProcess.StartInfo.UseShellExecute = false;
buildProcess.StartInfo.RedirectStandardOutput = false;
buildProcess.Start();
buildProcess.WaitForExit();
....
}Assets/GB/Editor/post_process.py
...
facebookAppID = /* Facebook App ID */
...
plist["AppLovinSdkKey"] = /* AppLovin Sdk Key */In order to require access to user Social authentication, handle payment (In App Purchase) and show Google Admob or require access to a player Google Play Game Service.
using GB;
using GooglePlayGames;
GBManager.ConfigureSDKWithGameInfo("", 1, GBSettings.LogLevel.DEBUG);
#if (UNITY_ANDROID && !NO_GPGS)
// Google Play Games Initialize
PlayGamesClientConfiguration config = new PlayGamesClientConfiguration.Builder()
.Build();
PlayGamesPlatform.InitializeInstance(config);
// recommended for debugging:
PlayGamesPlatform.DebugLogEnabled = true;
// Activate the Google Play Games platform
PlayGamesPlatform.Activate();
#endif
string adMobId = string.Empty;
#if UNITY_ANDROID
adMobId = /* AdMob Ad Id */;
#elif UNITY_IPHONE
adMobId = /* AdMob Ad Id */;
#endif
GBAdManager.Instance.Init(adMobId, onRewardAdCompleted);To sign in, call GBSessionManager.Login, which is part of the standard Unity social platform interface.
using GB.Account;
...
// authenticate user:
// Already have a last session?
if (GBSessionManager.isReady()) {
GBSessionManager.Login(sessionCallback);
}
else {
// Default AuthType.GOOGLE
#if (!UNITY_EDITOR && UNITY_ANDROID)
GBSessionManager.LoginWithAuthType(AuthType.GOOGLE, sessionCallback);
#elif (!UNITY_EDITOR && UNITY_IPHONE)
GBSessionManager.LoginWithAuthType(AuthType.GUEST, sessionCallback);
#endif
}Authentication will show the required consent dialogs. If the user has already signed into the game in the past, this process will be silent and the user will not have to interact with any dialogs. (Only Android)
Both iOS and Android support IAP.
GBInAppManager.QueryInventory(skus, (GBInventory inv, GBException exception) => {
});
before BuyItem called it, must call QueryInventory
GBInAppManager.BuyItem(/* product id */, 0, (string paymentKey, GBException ex) => {
});
GBInAppManager.RestoreItems((List<string>paymentKeys, GBException exception) => {
});
Once the plugin is initialized, you can start loading ads. To do so, you invoke the method Show of GBAdManager. The first ad can also be loaded automatically by switching on the field onRewardAdCompleted callback.
GBAdManager.Instance.Init(adMobId, onRewardAdCompleted);
...
if (GBAdManager.Instance.isEnableAds())
GBAdManager.Instance.ShowAd();| Back | FazBrowse Home | New Git URL |