We usually recommend bringing external dependencies into your project. So, adding a script for the Facebook SDK to your project and copying the contents into it.
That said, there is no particular reason it should fail to load. To load scripts we are just creating script tags and attaching them to the page.
You can also use the Script Priority feature (which is I admit somewhat hard to find). If you add a script to the script priority list it will be loaded before other scripts in the scene. This is useful for any scripts that are not “playcanvas” scripts, e.g. libraries and SDKs that you need in your project.
The Script Priority dialog can be found in the main menu (click the PlayCanvas logo in the top left).
Feel free to take my project apart and examine why the facebook SDK “sometimes” calls window.fbAsyncInit.
We are aborting this project with PlayCanvas and are going to implement it in Unity.
The Editor looks fancy, but trying to be productive with PlayCanvas is extremely frustrating.
Hope you guys improve on this in future versions.
We will have another look at PlayCanvas when debugging, development and documentation are greatly improved.
It looks like you were still including the SDK from FB’s CDN, so it was being loaded twice. I suspect this was causing problems with the callback.
When loading your original I could see that sometimes it wouldn’t trigger the FB dialog because of some kind of race condition. When I removed the sdk script from the SocialManager entity I found that the script loaded 100% of the time. See my fork here: https://playcanvas.com/project/359803/overview/asynctdfork
Sorry, you had a tough time getting up to speed. It’s always tricky getting started with new technology and whilst we try to maintain the docs as best we can, there are always places that fall through the cracks. I’ll update the docs to be more detailed about how to include javascript libraries. Hope your project goes well and you give us another try soon.
Hi, we inteded to post this later, but as you already asked, we quickly noted the most important things:
This is mostly the negative feedback, we did have our “wow wtf this is just unreal!” moments concerning the performance in the examples and the google docs-style collaboration magic.
At first we wanted to use PlayCanvas Engine without the editor, because we dislike editor-centric workflows and prefer pure-code (editors only for level editing, not for script attaching etc)
This workflow was largely undocumented and the engine examples were all included in script tags,
which is not how we would write an entire game. Thus getting a feel for how to build a simple app was quite difficult.
We read that PlayCanvas features an Entity Component System, but working with the Components felt as sluggish as it does with unity. We would have preferred to be able to write a system that iterates quickly over all components of a type without bothering with the Scene Hierarchy.
Is there a way to “see” the context in which the game is run?
You can add a svg tag to draw UI (I read there’s no native UI system yet, and SVG is powerful after all),
but you lose that in “some script”.
Finding the usages of scripts (what entities are they attached to) is something we were missing as well.
OOP with Javascript itself is a horrible experience. I hope ECMAscript 6 classes will be a cure.
We also were happy to read “opensource”, but the source is hard to read/navigate (JS) and from within your cloud-editor, “go to declaration” is a missing feature for this to be handy.
Coming from a Java background (Eclipse, Netbeans, IntelliJ), we are used to very intelligent IDEs and strong refactoring capabilities. The Javascript Ecosystem fails miserably when it comes to these feature.
Your editor looks nice but lacks many features. When writing a script, I feel like I am blind, testing out if an entities scripts are accessed via “entity.script.” or “entity.scripts.”, for example.
In comparison C# with MonoDevelop offers correct autocompletion.
We tried JetBrains Webstorm, but it also has problems with autocompletion of PlayCanvas.
Lots of this is, of course: "The only upside of Javascript, is that it’s native in browsers. The language itself is a monster."
Basically, The Editor is beautiful, but the rest indeed felt like v 0.1x
Do you know if window.fbAsyncInit has to be defined before the script is loaded? It seems that it’s a race condition on script loading order, but I don’t know much about the FB SDK.
In my previous example (engine only, no editor) I pre-loaded the sdk with requireJS before defining window.fbAsyncInit.
I didn’t have a race condition in that case.