Unity quickstart
FRVR ships a Unity wrapper — a .unitypackage that bridges your C# code into the FRVR SDK for Unity games exported to WebGL. You write C#; the wrapper handles the JS boundary inside the WebGL build.
What the wrapper gives you
Section titled “What the wrapper gives you”A deliberately small C# API surface under the FRVR namespace:
FRVRSDK.Init— bootstrap. Also:FRVRSDK.IsInitialized,FRVRSDK.IsAvailable,FRVRSDK.Version.FRVRSDK.GameReady— signal that loading is done and the game is interactive. Call once, after all loading completes (see §5).FRVRSDK.Ad.ShowInterstitialAd/ShowRewardAd/ShowBannerAd/HideBannerAd/IsAdReadyFRVRSDK.Score.SetScore— submit the player’s current score to the channel’s native leaderboard (Game Center / Play Games).FRVRSDK.Analytics.LogFTUE/LogLevelStart/LogLevelEnd/LogEventFRVRSDK.Data.SetItem/GetItem/RemoveItem/RemoveItems/SetItems/GetItems/SetLocalJson/GetLocalJson(local) andSetCloudItem/GetCloudItem/RemoveCloudItem/RemoveCloudItems(cloud)FRVRSDK.Social.CanInvite/Share/Invite/AddShortcut/SubscribePushMessagesFRVRSDK.IAP.IsReady/GetCatalog/GetProduct/GetProductPrice/Purchase/ConsumePurchase/GetUnconsumedPurchases/RestorePurchasesFRVRSDK.Tournament.IsSupported/IsSupportedAPI/GetCurrentTournament/PostScore/Create/CreateOrPostScore/GetMyTournaments/GetActiveTournaments/Join/Leave/InvitePlayersFRVRSDK.Notifications.CanScheduleMessages/SubscribeScheduleMessages/ScheduleMessage- Top-level helpers:
FRVRSDK.GetChannelID/GetEntrypointData/GetAllowExternalLinks/MuteVolume/UnmuteVolume/SetVolume/GetVolume/IsMuted
It is not a 1:1 of the JavaScript SDK — it’s the subset that makes sense in a Unity game, with a C#-native shape (callback-based rather than Promise-based).
1. Install the wrapper
Section titled “1. Install the wrapper”Download the latest frvr_sdk<version>.unitypackage from the Downloads page and import it via Assets → Import Package → Custom Package….
2. Unity project requirements
Section titled “2. Unity project requirements”These settings are required, not suggestions:
- Unity 6.1 or newer. The wrapper relies on recent Unity Web optimisations.
- “Run in background” must be OFF (
Project Settings → Player → Resolution and Presentation). - Default Unity WebGL template (
Project Settings → Player → WebGL → Resolution and Presentation → WebGL Template: Default). - Brotli compression on the build, with fallback compression enabled (
Project Settings → Player → Publishing Settings → Compression Format: Brotli, and keep the fallback setting enabled).
For additional build‑size and performance guidance see Unity web optimization tips.
3. Audio (required for iOS mute behaviour)
Section titled “3. Audio (required for iOS mute behaviour)”Facebook on iOS enforces the system mute button aggressively. If your audio isn’t imported with the right settings, mute will silently break:
- Load Type: Decompress on Load
- Compression Format: AAC (for iOS‑mute compatibility) — PCM if AAC isn’t viable
Apply these to every AudioClip used in game; missing the setting on even one clip is enough to fail mute compliance.
4. Initialize the SDK
Section titled “4. Initialize the SDK”Drop a bootstrap MonoBehaviour into your first scene:
5. Signal the game is ready
Section titled “5. Signal the game is ready”FRVRSDK.Init only bootstraps the SDK — it does not tell the host channel the game is playable. Once all loading is finished and the player can actually interact (your main menu or first playable frame is on screen), call:
Call it exactly once, at the very first moment the game is interactive — never while a loading bar, splash, or transition is still on screen. This is the Unity equivalent of the Web SDK’s FRVR.bootstrapper.complete(): the host keeps showing its own loading UI until you call it, then hands control to the player.
6. Use the modules
Section titled “6. Use the modules”Each call takes three callbacks — start, error, finish. The error callback receives an SdkError struct (error.error is the message string).
Analytics
Section titled “Analytics”Storage (local + cloud)
Section titled “Storage (local + cloud)”Local (per device):
Cloud (follows the player across devices):
Social (share & invite)
Section titled “Social (share & invite)”Check the surface first — not every channel supports every action:
Share a screenshot as a data URL (the wrapper expects base64):
An invite dialog with structured entrypoint data:
Tournaments
Section titled “Tournaments”Score (native leaderboards)
Section titled “Score (native leaderboards)”Submit the player’s current score to the channel’s native leaderboard (Apple Game Center, Google Play Games). This is separate from FRVR tournaments — use it in addition, on channels that expose a native score surface (e.g. YouTube Playables).
The submitted value should match the player’s best score in cloud save. On channels without a native score surface the call is a harmless no‑op, so you don’t need to guard it. See the Web SDK score reference.
Notifications (Facebook Instant)
Section titled “Notifications (Facebook Instant)”Common gotchas
Section titled “Common gotchas”- Editor runs in simulation mode. Playmode in the Editor uses fixtures (ads play a 3-second placeholder, IAP returns a synthetic purchase, storage writes to
Library/FRVRSim/). It does not talk to the real channel — final verification still requires a WebGL build run from afrvr.com/dev-frvr.com/localhosthost. - Consistent game naming. Every place your game name appears (logo, menus, promo images, ad copy) must use the same string. Mixing “Basketball FRVR” and “Basketball” will fail channel review.
- Audio imports are the #1 break. Getting even one AudioClip wrong on iOS will trip Facebook’s mute compliance check. Audit every clip.
Building for production
Section titled “Building for production”Do a normal Unity WebGL build with the settings above. Hand the build to FRVR’s release pipeline (or your FRVR contact). FRVR handles:
- Replacing dev CDN references with local paths in
index.html. - Bundling the correct per-platform channel adapter (Facebook Instant, iOS WebView, Android TWA, Samsung, Xiaomi, …).
- Packaging everything into the zip / package delivered to players.
You don’t self‑host and don’t pick a production channel bundle.