0
votes

Already posted this on Unity Forum and Unity Answers, but either support there moves too slowly or it's not been encountered. Thought I'd post to SO as well

I've been trying to update our current Unity project to use the new Facebook SDK for Unity and all the lovely features that come with. Up until now all we've had is a server-side implementation to request permissions using the PHP SDK. We held off on further implementation as we knew the new SDK was going to be released imminently.

However, now that we're implementing it, we've run into a slight problem getting it to fit with our current process. Now that Facebook Apps can link directly to a deployed .unity3d file, the PHP page that the web player used to sit in no longer gets hit and as a result, none of the PHP code is executed. We used the server-side code and PHP SDK to do the account creation for new users but because this is no longer being hit, new accounts are no longer created.

In the settings for the Facebook SDK for Unity asset, it actually has a tick box for "Cookie" with a description that implies usage in server-side code... but I have no idea how I'm supposed to access this cookie when the web page specified as the Facebook App's (Secure) Canvas URL is never hit... not even once.

I've searched around and can't find anyone else with a similar problem, so either I'm doing something wrong or it's not been encountered? Hopefully it's something simple and I'm just being daft

Anyone know how to solve this?

Thanks!

1

1 Answers

0
votes

You can pull your server-side account creation into an async call. After calling FB.Login(), take the FB.UserId in the callback when you get it and pass it to your backend to check if they have an account. create one if they don't.

I don't think you need the cookie support, but if you do, it follows the same as the Javascript SDK, so you should be able to use ExternalEval() and Javascript to get at the data.