Test your WebGL content on Facebook with Unity's new Facebook build target

As announced here , Unity 5.6 will add a new Facebook build target, which allows you to integrate Facebook into your builds (both WebGL and Gameroom), and upload your games to Facebook straight from the Unity Editor.

You can test this functionality based on a Unity 5.5 beta build available here: Facebook Games - Documentation - Meta for Developers

We would love to get some feedback from WebGL developers on this functionality. If you are interested, please give it a spin, and share your experiences in this thread.

1 Like

Kind of hard to even consider this as a platform when their limit size for a game is 50mb compressed.

I don’t think that is a requirement. It is listed as “best practice” on the page, which surprises me, because many of the games currently on Gameroom are much bigger then that.

1 Like

The 50 MB limit is inaccurate in the documentation, it has been removed to avoid further confusion.

2 Likes

That’s great news.
Is there a limit in place at all then?

The german version of the page:

https://developers.facebook.com/docs/games/gameroom/launch

shows me this content:

Launch deines Spiels in Gameroom
Wenn du dein Spiel entwickelt und getestet hast, kannst du es in Facebook Gameroom verĂśffentlichen.

Hosten deines Spiels auf Facebook
Anforderungen zum Hosting
Facebook bietet unter folgenden Voraussetzungen kostenloses Hosting fĂźr Spiele an:

  • Die Gesamtgröße einer einzelnen hochgeladenen ZIP-Datei darf hĂśchstens 200 MB betragen.
  • In Einzelfällen hosten wir eventuell bis zu 500 MB.

Weitere Informationen zum Hosting durch Facebook findest du in der Dokumentation.

But in the english version i don´t see “hosting”

It ´s a liitle bit confusing!
So let´s hope it´s because everything is new.
May be we get 500MB;):stuck_out_tongue:

1 Like

Currently i am testing Unity 5.5.0b9 for Facebook.
I can create, uploade und play if i use in the Build-settings: Facebook → Gameroom(Windows).
But when i use Facebook → webgl : i can create and upload to Facebook but then i can´t start the game.
Questions:
Should the game normaly start in a browser(Firefox) or in the Facebook Gameroom-App ?
Where can i find the settings for webgl, if the game is hosted on Facebook?

As mentioned in my post above, I can create a Webgl-Build and upload to Facebook but if start the game, i get this error:

I´m shure is my fault. Can somebody give me an hint? Thanks

I’m trying to understand whether this user story is possible… “I want to play this game inside Facebook on my iPhone.” Meaning, run a webgl blob inside the user’s news feed (not the game room “Instant Games” on Facebook mobile). The use case is the ability to share mini games and have them appear as playable units directly in the wall in the mobile app. Specifically, we have people making mini games in unity playing in webgl, and they would like to “post my game to my Facebook” and have their pals play it instantly inside the feed (no horizontal shift to a game download in another section of Facebook). Specifically, look at this page: getready.io/arcade. Each of these projects is a Webgl container made in unity that’s embeddable on any site- you can embed them in Facebook but the deep link re-routes to our an app download to play- in this version it would play instantly inside Facebook as webgl. So this blob would go into Facebook if we submitted our “player” to Facebook. But we can’t figure out if the current version supports this type of use case. Can anyone explain, or better yet, point to an existing Facebook Page that plays webgl content inside the feed. That would be super helpful to see. Thank you!

1 Like

This is currently not really possible. As mentioned in the manual we don’t support mobile at the moment for our WebGL export.
You might be able to make your content run on some high end devices but on average handhelds it will probably not run. Sorry.

i publish 4 games recently on facebook and it past 2 months and not see players on my game, please help

While the game perfectly shows up and plays on apps.facebok.com built with webgl and hosted on facebook it doesn’t show up in gameroom. only one time it did show up and i was able to play which was even faster than web browser. now i don’t know why it doesn’t show up on gameroom. there is only settings about gameroom “native” on developers.facebook.com but we target webgl only.
edit: i’m also able to play the game on gameroom via “downloaded games” tab…
can anyone help me or show me an “updated and complete” guide about gameroom webgl publishing.
edit2: now it started showing up in gameroom. i gues for some supernatural reasons.

1 Like

I’m trying to upload a build I made using the Facebook target to my Facebook Dev Portal, but I keep getting this “Error (try uploading again)” with no explanation on what the error is. Has anyone else come across this error or has some insight on what it could be? I’ve tried uploading manually as well as through the Unity Editor but it doesn’t seem to matter.

Thanks,

Chris

Yeah, I’ve run into this problem…quite awhile ago and did resolve it. So from distant memory, this is what happend and how I fixed it. I manually created a zip file to upload to facebook. It was somewhat large so it takes a long time to load. After the long load time I got
“Error (try uploading again)”

In short, it was a file format problem :

  1. Not a zip file
  2. Zip file contained wrong/missing build files

This was for a WebGL build and that’s where I’ve asked for help (from Unity) and haven’t got any help yet :

  • Facebook WebGL Unity game takes 40 - 60 seconds to load just for a splash image and ‘play’ button
  • Unity best practices for reducing load times doesn’t seem to work on Facebook
  • Unity Bundles must be included in the zip file
  • Unity can’t find files on facebook ‘tab’ pages (a work around for CORS)
  • Does Unity ‘appdata’ work on Facebook?
  • How do you find the FB appdata dir name?
  • Unity streamed data must be in zip file
  • Can’t stream data/bundles on cross-domain URL’s due to CORS restrictions

No body is really going to play my games deployed on Facebook because the load times are way too long.

BTW, I hope that my reply helps you fix your problem

I tried facebook native gameroom build/hosting for my WebGL build/hosting on facebook using Unity 2017.1. The native gameroom features should solve a bunch of the WebGL limitations but…the unity built-in ‘upload build’ doesn’t work for me either. I get the above mentioned error : ‘Error (try uploading again)’

  • It did ‘scan’ my local files
  • It did begin and upload about 4Mb of 40Mb of uncompressed files
  • Not sure if it tried to upload compressed or uncompressed files

I was able to uncompress the 7zip created by the Unity build and upload that manually to facebook (about 49 files). Facebook initially reports a file size of about 40mb then does some ‘processing’ after which the file size is reported as about 10mb.

I was able to discover the game via facebook gameroom but it didn’t run (got a URL error). I was able to discover and run a local unity build via a gameroom ‘debug’ mode. The load time was faster (by about 1/2). If I can load the game, it runs and works as expected without errors.

I can no longer discover the game via gameroom and can’t load and run it.

I can still see the debug local build for debugging via a gameroom menu and debugging button.

My goal is to have a platform for players to discover my game and play it. I still have hope that facebook will be one of those platforms.

This is the error message detail for Unity 2017.1, using ‘built-in’ facebook SDK 7.9.4 for 1 unity scene with default main cam and dir light. Project has only facebook SDK settings and 1 168K texture; using ‘build for fb upload’. Facebook AppId and upload token added to build/player settings. This is for native gameroom build.

Uploading build to Facebook failed: stdout:
Uploading C:/Unity2017\SplashNPlayScn1-v1.7z to https://graph-video.facebook.com/1510326922381419/assets
stderr:
WebException error: System.Net.WebException: The request was aborted: The request was canceled.
at System.Net.ConnectStream.InternalWrite(Boolean async, Byte[ ] buffer, Int32 offset, Int32 size, AsyncCallback callback, Object state)
at System.Net.ConnectStream.Write(Byte[ ] buffer, Int32 offset, Int32 size)
at Uploader.HttpUploadFile(String url, String artifactsUrl, String paramName, String contentType, NameValueCollection nvc)
at Uploader.Main(String[ ] args) ResponseUri =

System.Threading.RegisteredWaitHandle:smile:oCallBack(Object)

Same issue …

System.Net.WebException: The request was aborted: The request was canceled:
We’re looking into this, should be fixed soon from FB side. And new uploader implementation almost ready, that also will help avoid such situations.

@ghost99 :

Unity best practices for reducing load times doesn’t seem to work on Facebook
Actually, should work. Also, you can try to build webgl build and check build report → stripping (Build Report) for anything that makes your build big and remove that (like 3d physics if you don’t need that)

Unity Bundles must be included in the zip file
Well, if you want to include them then yes. But another option is to use your backend with https + setup CORS there

Unity can’t find files on facebook ‘tab’ pages (a work around for CORS)
what’s tab pages? can you elaborate please?

Does Unity ‘appdata’ work on Facebook?
What’s appdata exactly?

Unity streamed data must be in zip file
Is it a question?

@jonas-echterhoff_1

I think you guys are doing a great job as I just managed to get Chasmic Rush up and running in Facebook using WebGL using 2017.1. Note that FYI 2017.2 WebGL is broken.

The game looks nearly identical to the iPhone version, though I did have to remove the blur optimised as the strain would be too much for the browser.

I wrote about my experience on my blog where unfortunately integrating with Facebook became really painful, so I do think there is some way to go.

I do have ideas on how to fix this though…

Hey jonas-echterhoff, others,

Having some difficulty integrating my WebGL game into Facebook.

I’m having issues I assume are due to iframe sandboxing (not sure), but seems my parameter passing between Unity ↔ HTML/JS won’t work in the Facebook iframe…

Trying the exact same setup using vanilla WebGL and my own web server works without issue, but as soon as I attempt the same in the Facebook iframe, things fall apart.

This post here: WebGL Facebook game - Application.ExternalCall(...) and gameInstance.SendMessage(...) don't work. covers most of the details.

I could really do with some assistance here, I’ve been trying/testing/researching for over a day now with very little success.

Any ideas?