Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
  • Help Room /
avatar image
0
Question by shaheer141 · Apr 23, 2018 at 11:32 AM · webglfacebook

Facebook WebGl Instant game stuck at 0% Loading

Following the Guides given at

https://developers.facebook.com/docs/unity/gettingstarted and https://developers.facebook.com/docs/unity/getting-started/canvas

I built a demo Facebook Instant Game using unity 5.5.2 however whenever I test the game on facebook (both from android messenger and web) the loading is stuck at 0%. The scene however always loads completely behind the loading screen as shown in the image attached. Do i need to call some function from the facebook unity plugin or am i missing something else on the facebook app settings page?? NoLoading.png alt text

noloading.png (109.0 kB)
Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

6 Replies

· Add your reply
  • Sort: 
avatar image
0

Answer by Zotrov · May 02, 2018 at 12:34 PM

I'm also having this problem...

But what I think is going on is: There might not be a place to tell Facebook instant game the percentage loaded, if that makes sense.

First step in this doc: https://developers.facebook.com/docs/games/instant-games/getting-started/quickstart

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image
0

Answer by UDN_0111454d-2d8c-40da-8c8e-ee284a7f58f7 · Aug 01, 2018 at 08:46 AM

Same here! I menage to publish Facebook Web Game and on Gameroom ,but could not on Instant games. Which in strange since both Facebook web games and Instant games are webgl builds.

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image
0

Answer by ShaheerTahir · Sep 13, 2018 at 08:14 AM

I managed to solve all the issues and recently released a course on Udemy on how to port your Unity game to Facebook Instant without using external tools like Export2Canvas, and also how to interact with the Facebook instant library from a unity game.

https://www.udemy.com/creating-facebook-instant-games-using-unity/

Also I am working on a plugin to automate the whole process (leaderboards and facebook ads included), which i hope to release this week.

first five can get the course for free using the coupon code INSTANT4UNITY just make sure to leave a review

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image
0

Answer by Trusty · Nov 16, 2018 at 09:59 PM

Well, all is explain in the doc but I admit it's not very clear if you are not familiar to HTML5. Maybe a bit late but for those who will face same issue :

  • Build your game for WebGl.

  • Edit index.html to add FBInstant support and call the inialize function as in the documentation /!\ Remplace the "WebGl.json" by your script name. This resolve the SDK error you should have seen ( don't know how you pass it )

       <!DOCTYPE html>
         <html lang="en-us">
           <head>
             <meta charset="utf-8">
             <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
             <title>Unity WebGL Player | FacebookSample</title>
             <link rel="shortcut icon" href="TemplateData/favicon.ico">
             <link rel="stylesheet" href="TemplateData/style.css">
             <script src="TemplateData/UnityProgress.js"></script>         
             <script src="https://connect.facebook.net/en_US/fbinstant.6.1.js"></script>       
             <script src="Build/UnityLoader.js"></script>
             <script>FBInstant.initializeAsync().then(function() {
     var gameInstance = UnityLoader.instantiate("gameContainer", "Build/WebGl.json", {onProgress: UnityProgress});
                });    
             </script>
           </head>
           <body>
             <div class="webgl-content">
               <div id="gameContainer" style="width: 960px; height: 600px"></div>
               <div class="footer">
                 <div class="webgl-logo"></div>
                 <div class="fullscreen" onclick="gameInstance.SetFullscreen(1)"></div>
                 <div class="title">FacebookSample</div>
               </div>
             </div>
           </body>
         </html>
    
    
  • Tell Facebook Your game is loaded. Add the StartAsync

-

 function UnityProgress(gameInstance, progress) {
   if (!gameInstance.Module)
     return;
   if (!gameInstance.logo) {
     gameInstance.logo = document.createElement("div");
     gameInstance.logo.className = "logo " + gameInstance.Module.splashScreenStyle;
     gameInstance.container.appendChild(gameInstance.logo);
   }
   if (!gameInstance.progress) {    
     gameInstance.progress = document.createElement("div");
     gameInstance.progress.className = "progress " + gameInstance.Module.splashScreenStyle;
     gameInstance.progress.empty = document.createElement("div");
     gameInstance.progress.empty.className = "empty";
     gameInstance.progress.appendChild(gameInstance.progress.empty);
     gameInstance.progress.full = document.createElement("div");
     gameInstance.progress.full.className = "full";
     gameInstance.progress.appendChild(gameInstance.progress.full);
     gameInstance.container.appendChild(gameInstance.progress);
   }
   gameInstance.progress.full.style.width = (100 * progress) + "%";
   gameInstance.progress.empty.style.width = (100 * (1 - progress)) + "%";
   FBInstant.setLoadingProgress(100*progress);
   if (progress == 1)
   {
       FBInstant.startGameAsync().then(function(){
          console.log("Game Started"); 
       });
       
     gameInstance.logo.style.display = gameInstance.progress.style.display = "none";
   }
 }





Well done !

Comment
Add comment · Show 4 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image SahanD · Jan 24, 2019 at 05:07 AM 0
Share

where to add StartAsync?

avatar image ASHStudioinc · Oct 10, 2019 at 01:01 PM 0
Share

After doing this its working Only On web but not loading On messenger what should i do to run there as well

avatar image ankit010 · Jun 22, 2020 at 06:54 AM 0
Share

Its not working on messenger but on web. Please help

avatar image praveenydv07 ankit010 · Oct 01, 2020 at 08:59 AM 0
Share

Did you solved it? Then please tell me. How?

avatar image
0

Answer by dahliaivy006 · Apr 23, 2020 at 05:48 AM

You need to be using the Instant Games API. For example:

FBInstant.intializeAsync().then(() => { // load your game return FBInstant.startGameAsync(); }).then(() => { // your game logic }); You can't use this API directly from C# as it's a JavaScript API. To use JavaScript from Unity see this tutorial

DGCustomerFirst

,I’ve been following along with the Defold platformer tutorial, so I thought I’d try to get it to run as a Facebook Instant Game. I added the dependancy to the GitHub master zip, configured the app on Facebook Dashboard, and copy-pasted my App ID into the facebook section of game.project. Then I bundled the project as an HTML5 game, and added the reference to the Facebook Instant Games script in the resulting index.html. However, when I upload the game to Facebook and try to run it on my phone through Facebook Messenger, the loading gets stuck around 80-90%. Has anyone else encountered this?

DGCustomerFirst

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
  • 1
  • 2
  • ›

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

149 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Facebook SDK does not return focus to game canvas after FB purchase popup closed 0 Answers

how to fixe ios probleme in instant game Webgel ? 0 Answers

Unity Facebook WebGL Hanging at "Compilee asm.js module" 0 Answers

Detect if WebGL is on Facebook canvas 1 Answer

Facebook Support on WebGl Games (not Canvas) 0 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges