Unity
Unity projects targeting Android and iOS.
integrate
Section titled “integrate”Run alphyn-cli integrate from the root of a Unity project (the folder containing
ProjectSettings/). It:
- Downloads the Unity plugin and the iOS framework, verifying each one’s integrity before any
write. The Android library (the
com.byterialab:alphyn-sdkAAR) is not downloaded: it resolves from the Alphyn package registry at build time. - Places the C# plugin under
Assets/AlphynSDK/and the iOS framework underPlugins/iOS/, and wires the Android SDK to resolve from the registry through the project’s custom Main Gradle Template (Assets/Plugins/Android/mainTemplate.gradle): it adds the registry Maven repository and thecom.byterialab:alphyn-sdkdependency. No AAR is copied into your project. - Writes a post-build script (
Assets/AlphynSDK/Editor/AlphynRegisterPostBuild.cs) that registers the build after a successful player build. It hard-codes no host or API key (both are resolved when the CLI runs), so there is no staging/production split baked into your project. - Records the result in
alphyn.json.
Two settings make the registry wiring take effect. In Player Settings > Publishing Settings,
enable Custom Main Gradle Template so Unity uses mainTemplate.gradle, and supply your app API
key as ALPHYN_REGISTRY_KEY in the build environment. iOS needs no registry key: its framework is
bundled. See SDK Registry Access and
Installation:
export ALPHYN_REGISTRY_KEY=<YOUR_APP_API_KEY>If your build cannot reach the registry, use the self-contained plugin that carries the AAR instead: see Offline: the self-contained plugin.
Unity projects are created in the Unity Editor, so
alphyn-cli new unityis not supported. Create the project in the Editor, then runintegratein the project folder.
register
Section titled “register”A Unity Android player build is an ordinary APK, so it registers like a native Android
build; the post-build script invokes alphyn-cli register --apk <built-apk> for you. A Unity
iOS build registers from its generated Xcode project’s post-build step. There is normally
nothing to run by hand.
A Unity project that ships both platforms enrolls under one portal app per platform, each
with its own API key (see How to Register Your App).
integrate --android-api-key <key> provisions the Android app’s key into a gitignored
.alphyn/android-api.key file that the post-build hook reads automatically, so an Android player
build registers with no further setup; override it per build with the ALPHYN_ANDROID_API_KEY_FILE
environment variable (a key-file path), or pass --android-api-key / --android-api-key-file for a manual
register. A Unity iOS build produces an Xcode project, so its iOS app’s key is supplied through
the Xcode post-action flow. The backend accepts a
registration only from the matching platform’s key.
doctor
Section titled “doctor”Confirms the Unity project is valid, the plugin is placed, the iOS framework is present, and the
Android SDK is wired (either the registry Maven repository and coordinate in mainTemplate.gradle,
or a bundled .aar on an offline install). It also checks that the Android Minimum API Level meets
the SDK’s floor, that the post-build script is present, and that the placed plugin tree still
matches the recorded checksum.
remove
Section titled “remove”Deletes the CLI-owned Assets/AlphynSDK subtree (the plugin, any bundled native binaries, and the
post-build script), unwires the registry from the custom Main Gradle Template, and removes
alphyn.json.
Known limitation
Section titled “Known limitation”Unity Android runtime initialization is being finalized together with the SDK. After
integrating, alphyn-cli doctor surfaces the current status, so you always know whether a build
is ready.