Skip to main content

Unity Installation

com.alogame.sdk is a UPM package that wraps the same native Android and iOS SDKs described on the Android and iOS pages. The compiled .aar and .xcframework are vendored inside the package, so there is no JitPack or SPM resolution of the Alogame SDK itself during your build.

It is not the Engine Bridge package. That one is an npm module for Cocos Creator and Egret. Both drive the same native dispatch table, but a Unity project uses this package and never installs the npm one.

Requirements: Unity 2022.3+, Android minSdkVersion 24+, iOS 14.0+. Android and/or iOS Build Support must be installed through Unity Hub — without the platform module the native code paths are compiled out entirely and a clean console proves nothing.

1. Add the package

Package Manager → +Add package from git URL:

https://github.com/alo-game/alogame-sdk-unity.git#0.1.2

Pin the tag. Newer tags are listed under releases.

This is a release repo, not the source repo

It ships the compiled native binaries per tag plus this package's own C#/Java/Swift glue as readable source. It is not the private gitlab.oeg.vn repo, which your Unity has no access to.

2. Add your game config

Create Assets/StreamingAssets/oeg_config.json:

Assets/StreamingAssets/oeg_config.json
{
"core": {
"game_id": 30,
"debug_env": true
}
}

Set debug_env: false for production. One file serves both platforms — on Android it lands in the APK's assets/, and on iOS a build post-processor copies it to the app bundle root, because Unity puts StreamingAssets under Data/Raw/ and the iOS SDK looks it up with Bundle.main.url(forResource:), which does not search there.

game_id is per platform, and the bundle ID must match it

The backend registers a game per platform, so the same bundle ID / package name usually maps to a different game_id on iOS than on Android. Build each platform with the id registered for it.

If the pair does not match what the backend has registered, remote config is rejected with Bundle ID không khớp với game đã đăng ký and every subsequent call fails. With no config file at all the SDK starts on game_id 0 and fails the same way — the iOS post-processor warns about this in the build log.

3. Initialize

Call Initialize() once at boot, before any other Alogame.SDK.* call:

using Alogame.SDK;
using UnityEngine;

public class Bootstrap : MonoBehaviour
{
private void Awake() => AlogameSDK.Initialize();

public async void OnLoginButtonClicked()
{
var login = await AlogameAuth.ShowLoginUI();
if (!login.Success) return;

// Report the player's server/role right after login — the payment and
// analytics backends key on it, so doing this late loses attribution.
await AlogameAuth.SetGameRole(serverId: "1", roleId: login.User.Uuid, serverName: "S1");
await AlogameAnalytics.LogEvent("game_start");
await AlogameSDK.ShowFloatingButton();
}
}
The Editor does not call the native SDK

AndroidJavaClass and DllImport("__Internal") are both no-ops in the Editor, so Play mode resolves through a mock transport. Run on a device or emulator to see real results.

4. Optional — Facebook / TikTok login

Only if your game uses them. Assets → Create → Alogame → SDK Settings, put the asset in any Resources folder named AlogameSDKSettings, and fill in the ids. A build post-processor reads it and writes the required AndroidManifest.xml and Info.plist entries. A game using neither provider needs no asset at all.

NSUserTrackingUsageDescription is written into every iOS build whether or not the asset exists — the SDK always requests App Tracking Transparency for Adjust attribution, and iOS terminates an app that requests it with no purpose string. Override the wording in the asset to match your game.

Known behaviour

ShowLoginUI() does not resolve the same way on both platforms. On iOS the returned Task completes when the login flow finishes and carries the signed-in user. On Android it completes as soon as the login screen is launched, with no user attached — so result.Success is false while the screen is still open. Until this is unified, do not treat an Android ShowLoginUI() result as the outcome of the login; poll AlogameAuth.GetCurrentUser() or AlogameAuth.IsLoggedIn() instead.

Duplicate Adjust classes at iOS launch. The console prints a long run of objc: Class ADJ… is implemented in both … warnings. The Alogame .xcframework links AdjustSdk statically, and the Adjust SPM package must also be present for the build to compile, so both copies end up in the app. This is expected and has not been observed to break anything — but do not add the Adjust Unity plugin on top, and never vendor AdjustSigSdk.xcframework yourself: the Adjust package already embeds it, and a second copy fails the build with Multiple commands produce …/AdjustSigSdk.framework.

Firebase is a no-op without GoogleService-Info.plist. The tracker logs Firebase Analytics disabled — no GoogleService-Info.plist; tracker is no-op and continues. Adjust still works.