Hey everyone,
I may be missing something simple here, but currently on Unity 5.6.3p1 we have the ability to build for Facebook (either Facebook Gameroom or WebGL via FB Canvas).
However, there seem to be no preprocessor directive (#if unity_facebook) or Application.Platform (RuntimePlatform.Facebook) in unity yet. So how would one distinguish between a regular Windows-Standalone and a Facebook build?
It would of course be possible to parse the URL to see if www.facebook.com is part of it to distinguish between FB WebGL and regular WebGL, but this does not seem like a pretty solution.
Thank you for the very quick reply, I didn’t find it in my search. Resharper doesn’t list the UNITY_FACEBOOK as available but I’ll give it a go anyway.
Do you happen to know about Application.Platform for FB?
Facebook gameroom is essentially a windows build, and since platform is the device it’s being played on, my guess is gameroom returns the windows platform while the webgl version returns the webgl platform. I haven’t tried to see myself with Application.Platform, but this is a pretty good guess I would think.
I don’t believe Facebook itself is considered a “platform”, but I could be wrong on that.
The thing is that both FB WebGL and FB Gameroom have special requirements vs regular WebGL / Windows Standalone builds that need to be met, and without a way to distinguish between a FB platform and a regular one this is made near impossible. But as @Brathnann mentioned above, the preprocessor directive for facebook DOES exist, even though it does not show up in the code suggestions and documentation.