Domanda

I'm working on a Facebook canvas game with Unity, and aside from weird Facebook behaviors, things have been moving along. I'm trying to follow the Facebook guidelines regarding when and which permissions to get authorized.

When I first start my app, I'm just getting the basic permissions (basic_info) as I really only need the user to be logged in first.

FB.Login("basic_info", loginCallback);

That works just fine as needed within the Unity editor, providing the token. When my app gets to a point where I would like to fire an OG story, though, I need to get publish_actions permissions first if they don't exist. According to everything I've found in my searches, the only way to get additional permissions via the SDK for Unity is simply to call FB.Login again, providing the permissions scope. So at the appropriate time, if I don't already have publish_actions in my permissions already I call:

FB.Login("publish_actions", loginPermCallback);

In the Unity editor, this isn't testable for me as the editor login takes a token, and if there's a way to specify this specific permission with the test user token, I haven't found it. So I'm testing this through the canvas hosted game. When this is called, I do get the dialog indicating that my app would like permission to post to the timeline. When I click ok to approve it, my game reappears but everything is locked up. Almost as if an infinite loop got hit, but I've done thorough checks, and this is only getting called once. It does in fact set the permissions for my test user however, from checking them in the Facebook app settings.

If I get both permissions when the app starts, things seem to work fine, but that isn't to be done according to the docs.

Also, is it normal that this dialog getting additional permissions to go full-screen? The window itself isn't full screen, but it includes a white background behind it that is full screen. I'm not sure if this ties in with the OnHideUnity callback maybe or not.

I'll provide additional info if necessary. I'm using Unity 4.3.4f, Facebook SDK 5.0.4

È stato utile?

Soluzione

After doing extensive trial and error with things, I found what was causing the lockup in my situation. In the scene in which I need to obtain additional permissions, I have a flag using a ClothRenderer in Unity. For some reason, the dialog for the permissions did not like the ClothRenderer running at all. I fixed my issue with a workaround, by turning off the ClothRenderer before calling FB.Login, then turning it back on inside the login callback.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top