Unity
Funox supports Unity WebGL builds via a Unity package.
Install
- Download the latest
FunoxUnitySDK.unitypackagefrom the Developer Portal. - In Unity:
Assets → Import Package → Custom Package…and select the file. - Copy the included
WebGLTemplates/Funoxfolder into yourAssets/WebGLTemplates/. - In
Player Settings → WebGL → Resolution and Presentation, select the Funox template.
Initialize
1using CrazyGames; // namespace name: Funox (legacy: CrazyGames in pre-release builds)2 3void Start()4{5 FunoxSDK.Init(() =>6 {7 Debug.Log("Funox SDK initialized");8 });9}Check status:
1if (FunoxSDK.IsInitialized) { /* safe to call SDK methods */ }2if (FunoxSDK.IsAvailable) { /* SDK is loaded in this build */ }Lifecycle signals
1FunoxSDK.Game.GameplayStart();2FunoxSDK.Game.GameplayStop();3FunoxSDK.Game.LoadingStart();4FunoxSDK.Game.LoadingStop();5FunoxSDK.Game.Happytime();Video ads
1FunoxSDK.Ad.RequestAd(2 AdType.Midgame,3 onStarted: () => AudioListener.pause = true,4 onFinished: () => AudioListener.pause = false,5 onError: (err) => AudioListener.pause = false6);Rewarded:
1FunoxSDK.Ad.RequestAd(2 AdType.Rewarded,3 onStarted: () => AudioListener.pause = true,4 onFinished: () => { AudioListener.pause = false; GrantReward(); },5 onError: (err) => AudioListener.pause = false6);User accounts
1var user = await FunoxSDK.User.GetUserAsync();2if (user == null)3{4 user = await FunoxSDK.User.ShowAuthPromptAsync();5}6 7string token = await FunoxSDK.User.GetUserTokenAsync();8// Send token to your backend for verificationSave data (typed)
1FunoxSDK.Data.SetInt("highScore", 12450);2int score = FunoxSDK.Data.GetInt("highScore", 0);3 4FunoxSDK.Data.SetString("inventory", JsonUtility.ToJson(inv));5FunoxSDK.Data.DeleteKey("highScore");6FunoxSDK.Data.DeleteAll();In-game purchases
1string xsollaToken = await FunoxSDK.IAP.GetXsollaUserTokenAsync();Pass the token to a Unity-compatible Xsolla SDK or call the REST API via UnityWebRequest.
Build settings
| Setting | Value |
|---|---|
| Compression Format | Brotli |
| Code Optimization | Size |
| Strip Engine Code | On |
| Enable Exceptions | None in release |
| Memory Size | Start at 256 MB, raise only if needed |
iOS is hard
Unity WebGL games are disabled on iOS by default because of memory crashes. Once your game proves stable on desktop and Android, it gets enabled. Keep peak memory low.
Optimization checklist
- Compress textures to ASTC/ETC
- Use
Resourcessparingly — prefer Addressables - Strip unused shaders
- Disable physics layers you don't need
- Enable IL2CPP code stripping