Facebook SDK for Unity (UPM Fork)
>-
com.lacrearthur.facebook-sdk-for-unity 
Install via UPM
Add to Unity Package Manager using this URL
https://www.pkglnk.dev/facebook-sdk-for-unity.git README Markdown
Copy this to your project's README.md
## Installation
Add **Facebook SDK for Unity (UPM Fork)** to your Unity project via Package Manager:
1. Open **Window > Package Manager**
2. Click **+** > **Add package from git URL**
3. Enter:
```
https://www.pkglnk.dev/facebook-sdk-for-unity.git
```
[](https://www.pkglnk.dev/pkg/facebook-sdk-for-unity)Dependencies (1)
README
Facebook SDK for Unity (UPM Fork) v18.0.0
A fixed and modernized UPM-compatible fork of the official Meta Facebook SDK for Unity v18.0.0.
This package solves the "Manifest Merger" and "GameActivity" crashes that plague the official SDK. It includes a Smart Android Manifest Sanitizer that automatically patches your build for Android 12+ (API 31) and properly handles the transition between Unity 2022 and Unity 6.
License: Facebook Platform License.
Why this fork?
- Auto-Fixes Android Manifest: Automatically detects Unity version and applies the correct Activity (
UnityPlayerActivityvsUnityPlayerGameActivity). - Android 12+ Ready: Automatically injects
android:exported="true"to prevent crashes on modern devices. - No "Link.xml" Hassle: Auto-injects preservation rules to prevent IL2CPP stripping.
- UPM Native: clean installation without
.unitypackageclutter.
Versioning Strategy
To maintain compatibility with the official Meta SDK while allowing for UPM-specific fixes, this package follows this versioning scheme:
[Facebook Major].[Facebook Minor].[Package Patch]
- Major & Minor (e.g.,
18.0): Strictly match the official Facebook SDK for Unity version. - Patch (e.g.,
.1,.2): Indicates updates to this UPM package (e.g., Manifest fixes, Editor scripts, Unity compatibility) without changing the underlying Facebook SDK binaries.
Requirements
- Unity 2022.3 LTS (Uses legacy
UnityPlayerActivity). - Unity 6000.x+ (Uses modern
UnityPlayerGameActivity). - Android SDK 34+ (Min API 21).
- iOS 12+ (Xcode 15+).
Installation
Via Unity Package Manager (Recommended)
- Window > Package Manager > + > Add package from git URL.
- Enter:
https://github.com/LaCreArthur/facebook-unity-sdk-upm.git. - Import > Wait for resolution (EDM auto-handles dependencies).
Via OpenUPM
- CLI:
openupm add com.lacrearthur.facebook-sdk-for-unity. - Or add registry to
Packages/manifest.json:"scopedRegistries": [ { "name": "OpenUPM", "url": "[https://package.openupm.com](https://package.openupm.com)", "scopes": ["com.lacrearthur"] } ], "dependencies": { "com.lacrearthur.facebook-sdk-for-unity": "18.0.0" }
Quick Setup
Meta App:
- developers.facebook.com/apps > Create App (Gaming) > Add Android/iOS platforms.
- Copy App ID/Client Token.
Unity Settings:
- Facebook > Edit Settings > Enter App ID, App Name, Client Token.
- Android: Package Name matches Player Settings (e.g., com.sorolla.test).
- Generate Key Hashes (requires JDK/OpenSSL in PATH, see Troubleshooting).
Player Settings (Android):
- Package Name: e.g., com.sorolla.test.
- Min API 21, Target 34, IL2CPP, ARM64.
- Publishing: Custom Main Manifest (auto-merges FB activities).
Build & Test:
- Build APK > Install on device.
- Logcat: adb logcat | grep Facebook, expect "Init Success."
- Meta Events Manager > Test Events: fb_mobile_activate_app appears.
Full API: Meta Docs.
Troubleshooting
- DLL Load Failed: Ensure link.xml in Assets/Facebook/ (preserves IL2CPP types). Reimport.
- Key Hashes Error: Generate via keytool | openssl (JDK/OpenSSL in PATH). Add to dashboard.
- Manifest Collision: Force Resolve EDM; check custom manifest for FBUnityActivity launcher.
- No Events: Clear app data on device; verify App ID (no "fb" prefix in manifest).
- iOS Pods Fail: EDM > iOS Resolver > Install Pods.
- UPM Import Hangs: Delete Library/ > Refresh.
License
Facebook Platform License © Meta (forked). See Developer Terms: developers.facebook.com/terms.
No comments yet. Be the first!