Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Facebooks share change - FB Unity SDK

Discussion in 'Scripting' started by Brathnann, Jul 24, 2017.

  1. Brathnann

    Brathnann

    Joined:
    Aug 12, 2014
    Posts:
    7,186
    Recently it appears Facebook has changed how they allow stuff to be shared. Currently we use the Facebook Unity SDK which provides both FB.FeedShare and FB.ShareLink options. However, with the new change, the image no longer gets shared through either of these calls.

    Is anybody currently sharing through another method that is still working for them?

    Appreciate any help provided.
     
    ikoukas likes this.
  2. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    38,520
  3. Brathnann

    Brathnann

    Joined:
    Aug 12, 2014
    Posts:
    7,186
    We're using FeedShare and ShareLink. I don't believe Feed is included in the FB Unity sdk.

    What actually seems to have changed is Facebook no longer allows custom images linked directly (which probably is why Feed doesn't work correctly either). So using either call, we normally passed in title, description, image link, and a link for when you clicked on the shared image.

    A little help on the Facebook developer group has me a little closer. Apparently I can set all that stuff to null or "" and that is now included in the html that we can link to instead of the image, but I'm just getting a white box. The faq makes some claims about image size and such, but we're under those specs.

    I also ran the html file through Facebooks sharing debugger and the image shows there, so now I'm still trying to figure this out.

    It's possible they haven't updated their Unity SDK to reflect the new change.
     
  4. jero252003

    jero252003

    Joined:
    Jan 5, 2017
    Posts:
    4
    Hi there,

    Were you able to work around this?

    Thanks.
     
  5. Brathnann

    Brathnann

    Joined:
    Aug 12, 2014
    Posts:
    7,186
    Can see my post here https://forum.unity3d.com/threads/f...not-posting-image-linked.485344/#post-3161201

    It basically is an html file with meta tags. Then we added a redirect link on it so when the image is clicked on, it redirects to the game depending on what platform you are on. I ended up using ShareLink and just passing in the html file url as the first parameter and setting the rest to null or "" (except the callback).
     
    Gokusansan likes this.
  6. Jobahed

    Jobahed

    Joined:
    Feb 24, 2014
    Posts:
    19
    I'm having issues with this. I wrote a PHP script on my server to generate a dynamic skeletal HTML page containing the required meta tags. Seems no matter what I try, Facebook posts a simple ugly rectangle with a link to my PHP script (not the link as provided in the meta tags.)

    I think I must be missing something simple. BTW...I'm testing it by pasting the link inside a status update in Facebook and watching Facebook interpret the results...I assume results from my app would be the same?

    -John
     
  7. Brathnann

    Brathnann

    Joined:
    Aug 12, 2014
    Posts:
    7,186
    Honestly, I'm no expert on this. Not sure if the PHP file works with facebooks sharing. I just made the HTML files and moved on. It's a little annoying, but it was quick and solved the issue at the time. It's possible it doesn't work because you are creating an HTML file dynamically and FB may not like that. (I think that's part of why the old way of sharing was removed)

    Facebook has a share debugger though at https://developers.facebook.com/tools/debug/sharing/ where you can post the link and have Facebook tell you what it doesn't like, so I would try it and see what happens.

    The debugger should mimic what your app users would experience if they share.
     
  8. Jobahed

    Jobahed

    Joined:
    Feb 24, 2014
    Posts:
    19
    Brathnann...that link is enormously helpful, thank you very much. Doesn't seem like the PHP is an issue (at first glance.)

    -John
     
  9. Brathnann

    Brathnann

    Joined:
    Aug 12, 2014
    Posts:
    7,186
    Glad it could help. Someone on the Facebook developer group posted this link and said they got the PHP thing working for them. https://forums.coronalabs.com/topic...ynamic-meta-tags/?fref=gc&dti=146797922030397

    If you still don't have it working, maybe it will help. I haven't looked over it myself yet
     
  10. Jobahed

    Jobahed

    Joined:
    Feb 24, 2014
    Posts:
    19
    I was able to get it working...my solution was very similar to the one in the link you shared. Very simple, create some GET parameters which are substituted into the skeletal HTML. Works great! Thanks again for your help.