facebook-sdk-for-unity
facebook-sdk-for-unity copied to clipboard
Feature Request: Option to use EditorFacebook instead of WindowsFacebook in Unity Editor
Checklist
- [x] I've updated to the latest released version of the SDK
- [x] I've searched for existing feature requests on GitHub issues
- [x] I've read the Code of Conduct
- [x] I've given my issue the title:
Feature Request: [name of my feature request]
Goals
Back to version 11.0.0, when we call FB.LoginWithPermission() in Unity Editor, FB will run the behavior from EditorFacebook, which uses Unity Editor Window to perform the login flow.
Since FB Unity SDK v12.0.0, FB started supporting Windows platform. If the Unity Editor is on Window platform, FB will run the behavior from WindowsFacebook. Facebook only supports Cloud gaming app on Windows platform. If the app doesn't have Cloud Gaming, it brings an issue that login FB in Unity Editor returns the error below (As explained by JodiFB in this Issue):
Error: FB Login Error: ERROR: Failed to start login flow,InnerErrorCode: 190,InnerErrorMessage: Error validating application. Invalid application ID.,InnerErrorSubcode: 0,InnerErrorTraceId: xxxxx
I am using Facebook Unity SDK 11.0.0 for my app and using Facebook login on iOS, Android, and Web. After upgrading the FB SDK to 15.1.0, I encountered this issue. As a result, I can no longer test FB login in Unity Editor on Windows, and I don't have the plan to use Cloud gaming in the near future. This is quite inconvenient for development. So I am requesting an option, like in FacebookSettings, to use EditorFacebook on Unity Windows Editor instead of WindowsFacebook.
Expected Results
- A boolean option in FacebookSettings to force using EditorFacebook for login in Unity Editor.
- If the option is true, use the login flow of EditorFacebook when calling FB.Login.
What do you expect to happen?
Code Samples & Details
Please provide a code sample, as well as any additional details, to help us track down the issue. If you can provide a link to a test project that allows us to reproduce the issue, this helps us immensely in both the speed and quality of the fix.
Note: Remember to format your code for readability:
Probably we need to change the code here. Something like:
// INSERT YOUR CODE HERE
if (!FacebookSettings.ForceEditorLoginFlow && {Existing condition})
{
FB.OnDLLLoadedDelegate = delegate
{
((WindowsFacebook)FB.facebook).Init(appId, FB.ClientToken, onHideUnity, onInitComplete);
};
ComponentFactory.GetComponent<WindowsFacebookLoader>();
}
else
{
FB.OnDLLLoadedDelegate = delegate
{
((EditorFacebook)FB.facebook).Init(onInitComplete);
};
ComponentFactory.GetComponent<EditorFacebookLoader>();
ComponentFactory.GetComponent<CodelessCrawler>();
ComponentFactory.GetComponent<CodelessUIInteractEvent>();
}