Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

Facebook and Unity 5

Discussion in 'Assets and Asset Store' started by Fluzing, Apr 29, 2015.

  1. Fluzing

    Fluzing

    Joined:
    Apr 5, 2013
    Posts:
    815
    We switched to Unity 5 because of awesomeness, but as an app developer we NEED the Facebook plugin to work properly and it doesn't. The official SDK has been getting 1 star reviews for over a month now, but there has been no response from the devs.

    My questions: are they working on it? Should I go back to Unity 4.6? Are there alternatives?

    This whole thing is just really annoying and unprofessional in my opinion.
     
    liortal likes this.
  2. mimminito

    mimminito

    Joined:
    Feb 10, 2010
    Posts:
    780
    NeatPlug/Prime31 has alternatives, check out their sites. As for Facebook themselves, there is no way to tell if they are working on it or not as there is no developer forum we can contact them via.

    Have you tried this in Unity 5? What are the issues?
     
    liortal likes this.
  3. Antony-Blackett

    Antony-Blackett

    Joined:
    Feb 15, 2011
    Posts:
    1,772
    I've got it working in Unity 5. It's not a big issue to get going as long as you support iOS or Android.

    To get iOS going you need to find the file 'FBUnityInterface.mm'. In the inspector for this file check iOS in the plugins section and then add this '-fno-objc-arc' to the compiler flags input at the bottom of the inspector.

    It should run fine for the most part, I believe there are a couple functions that don't really work in the editor, like re-requesting permissions but they work fine on device.

    As for Facebook Canvas and the Web Player. It works fine except that the Unity Web Player now doesn't run in Chrome. :(. The Facebook Plugin does not work in WebGL so you can't build that as a Chrome alternative as of yet.

    As for Facebook forums/development. There is no forum as such but you can see all open bugs and progress here: https://developers.facebook.com/bugs/trending/

    The last patch was only about 15 days ago(April 15th 2015) So they are actively working on it.

    I have seen in some bug reports relating to Unity 5, that get closed as 'invalid', that they are working on a Unity 5 compatible plugin. I suspect they may take their time making sure it works with WebGL... that's just a guess from me though, only they would know for sure.
     
    mimminito likes this.
  4. mimminito

    mimminito

    Joined:
    Feb 10, 2010
    Posts:
    780
    Thanks for this! Useful to know if we upgrade to Unity 5 as well.
     
    liortal likes this.
  5. liortal

    liortal

    Joined:
    Oct 17, 2012
    Posts:
    3,559
    We are using Facebook SDK v6.2 (beta) for a few weeks with Unity 5.0 and now 5.0.1p2
    I don't recall we had to make any changes to the project. Our game runs on mobile (iOS, Android) and on the web (both WebPlayer and WebGL).

    For the web versions, we actually wrapped the JS Facebook SDK so we can switch different implementations between mobile/web.
     
  6. Antony-Blackett

    Antony-Blackett

    Joined:
    Feb 15, 2011
    Posts:
    1,772
    I see, can you share your wrapped JS SDK code? :D

    Also, admittedly I haven't spend much time trying but I couldn't figure out how to get the WebGL build to run in Facebook Canvas, is there any trick to it?
     
  7. liortal

    liortal

    Joined:
    Oct 17, 2012
    Posts:
    3,559
    We're running our game in FB.

    What sort of trick are you looking for ?
     
  8. DennG

    DennG

    Joined:
    Dec 5, 2013
    Posts:
    158
    I can recommend you soom.la
    It's awesome and free.
     
    liortal likes this.
  9. Antony-Blackett

    Antony-Blackett

    Joined:
    Feb 15, 2011
    Posts:
    1,772
    I guess I just need to figure out how the web works. I'm new to HTML 5 and java on web.
     
  10. SwordStroker

    SwordStroker

    Joined:
    May 8, 2015
    Posts:
    6
    when i call FB.AppRequest or FB.Feed im getting this error.It was working yesterday but now it's not.I dont understand.Because i ddnt change any code. Ekran Alıntısı.PNG
     
  11. liortal

    liortal

    Joined:
    Oct 17, 2012
    Posts:
    3,559
    I never saw this error, we're using Unity 5 and Facebook SDK 6.2 ( think).

    What version of the FB SDK are you on ?
     
  12. SwordStroker

    SwordStroker

    Joined:
    May 8, 2015
    Posts:
    6
    Using SDK 6.2.2, Build 150414.98558e55096475c
     
  13. liortal

    liortal

    Joined:
    Oct 17, 2012
    Posts:
    3,559
    What platform is this screenshot taken from?

    I think Screen.showCursor was removed so that's why it's not found. This doesn't happen with the version we're using.
    Do you happen to have a full stack trace for this error ?
     
  14. SwordStroker

    SwordStroker

    Joined:
    May 8, 2015
    Posts:
    6
    It's builded on web player and I'm posting screenshot from facebook i'm already uploaded it for testing.
    MissingMethodException: Method not found: 'UnityEngine.Screen.get_showCursor'.
    at Facebook.AsyncRequestFriendSelectorGet.ShowDialog (.FBResult result) [0x00000] in <filename unknown>:0
    at Facebook.AsyncRequestDialogGet.CheckAndShowDialog (.FBResult result) [0x00000] in <filename unknown>:0
    at Facebook.AsyncRequestString+<Start>c__Iterator0.MoveNext () [0x00000] in <filename unknown>:0
    (Filename: Line: -1)
     
  15. liortal

    liortal

    Joined:
    Oct 17, 2012
    Posts:
    3,559
    I think that on WebPlayer and WebGL, Facebook downloads an additional DLL and uses it.
    On these platforms we aren't using the Facebook SDK for unity. Instead, we wrapped the FB Javascript SDK and call it from Unity. This is probably the reason we haven't seen this issue while testing...

    I guess it really doesn't support Unity 5, not on all platforms at least...
     
  16. Antony-Blackett

    Antony-Blackett

    Joined:
    Feb 15, 2011
    Posts:
    1,772
    Yeah, I get that issue too. But i didn't end up using the Facebook UI anyway . Using your own UI gets around the issue but i think liortal's Java wrapper seems to be the best option for Web now.
     
  17. Psyco92

    Psyco92

    Joined:
    Nov 15, 2013
    Posts:
    22
    Using unity 5, FB.AppRequest and FB.Feed work in editor but do not work in canvas. no errors, simply nothing happens.

    Does anyone have any suggestions.

    Today we are upgrading the project from 5.1 to 5.2 will post if anything changes
     
  18. liortal

    liortal

    Joined:
    Oct 17, 2012
    Posts:
    3,559
    @Psyco92 what FB SDK version are you using ?