Is it really that hard to share a simple score on Facebook and Twitter natively?

Hi

I’m doing a game and would like to give the user the ability to share his/hers score after end game.
I don’t want an app on Facebook or anything.

I just want to open up the “native” sharing UI, where I provide the text/image/link and then the user post it them self to twitter, facebook, email etc.

Can it really be correct that it’s so hard to find a plugin to help me with that? I need it to work on both iOS and Android (Windows Phone if possible), but right now I can’t seem to find a plugin that does this simple thing…all I find are plugins that either do the share UI them self in-game or need and Facebook app id, to post on behalf of the user.

Any one who can help out there?

I found this one, which seems to do what I want…but it’s only for iOS.

I need something to work on Android too.

Maybe this is enough for you:

string facebookshare = "https://www.facebook.com/sharer/sharer.php?u=" + Uri.EscapeUriString(appStoreLink);
Application.OpenURL(facebookshare);

string twittershare = "http://twitter.com/home?status=" + Uri.EscapeUriString(appStoreLink);
Application.OpenURL(twittershare);
1 Like

You can OAuth2 and post/get commands to pass info between social networking apis.

Uses the www class similar to posting to php highscore board, and the returned object is a hash with user info that was requested.

I use vuforia and it doesn’t play well with other plugins that require main activity so I’ve beat my head against the wall for a long time getting crap to work with facebook and twitter and vuforia.

Unishare in the asset store is the closest plugin I’ve seen to native. You can also try the official FB unity plugin.

Have you found the solution i am also looking for FB simple score sharing but no result yet … :frowning:

It’s very easy.

Facebook supplies a Unity SDK package. Download it, check it. It does all sorts of FB SDK integration.

Facebook has there own unity thing. Posting to facebook is alot more complex then it should be.''Unity SDK - Documentation - Meta for Developers

Not sure if this helps: https://www.assetstore.unity3d.com/en/#!/content/17803

It focus on FB leaderboard, but also allows posting scores. You will need to create an AppID though, as per the normal Facebook requirement. I don’t think Facebook allows bypassing or posting without linking your App to Facebook.

Hope it helps :frowning:

Sometimes it’s better to use standard platform-specific sharing functionality.
It’s sharing intent in Android. And in iOS it’s new social functionality included stating iOS6.

I created small package for my internal purposes that allows to easily integrate such kind of solution to your games. It’s available for free at: GitHub - vedi/share-bunch-unity3d. Currently it supports just text sharing, but it can be easily extended.

Any feedback is appreciated.

1 Like

This asset shares both facebook and twitter in ios and android

So there is no need to setup the app in facebook? It is only for ios right? is there anyway i can do it for android too???

Download the Facebook SDK for unity. Look at the example and bam! You know how to integrate Facebook. It works on iOS a d android. I have done this in my app. Its not that hard. Don’t install 3rd party stuff. I think its better to learn now and experience this kind of stuff. Just trust me, follow the Facebook instructions and just look at the examples. It works.

It also only takes like 30 lines of code (code that you can copy and paste from their examples)

is there anyway to do sharing without setting the app up at facebook?

Nope. Trust, just get that part over with and you never have to worry about ever again. All of your apps will be easy to put Facebook in because you have all the code you need. When I get home later, I will see if I can send you the code you need.

I’m thinking of doing the same thing (sans the part where the game asks for access to your entire friends lists to spam their feeds) and will use Facebook SDK for Unity too. Good luck & have fun.

public void PostFacebook()
    {
        if (!FB.IsLoggedIn)
        {
            FB.Login("email,publish_actions");
        }
        else
        {
            Util.Log("onShareClicked");
            FB.Feed(
                    linkCaption: "I popped " + highScore.ToString() + " circles! Can you beat it?",
                    picture: "<INSERT A LINK TO A PICTURE HERE>",
                    linkName: "Checkout Circle Pop on iOS and Android!",
                    link: "http://apps.facebook.com/" + FB.AppId + "/?challenge_brag=" + (FB.IsLoggedIn ? FB.UserId : "guest")
                    );
        }
    }

    void OnLoggedIn()
    {
        Util.Log("Logged in. ID: " + FB.UserId);
    }

    private void SetInit()
    {
        Util.Log("SetInit");
        if (FB.IsLoggedIn)
        {
            Util.Log("Already logged in");
            OnLoggedIn();
        }
    }

Just post that there somewhere in your code. Connect the PostFacebook function to a UI button. After that, import the Facebook SDK into your unity project. Setup you facebook app page and connect it to your unity project. Lastly, make sure you import the UTIL class from the Facebook examples. That is all you need to do! It’s super simple. No need for any plugins or anything.

EDIT: Forgot to mention, call SetInit(); in your Awake() function

1 Like

ya… :frowning: i did once but the guy i am working for dont want to setup the app on fb. Since for android i will need to add keyhash everytime he uses new keys…
for ios has a workaround though… .tnx :slight_smile:

I tried implementing your original project in unity 5. There’s a bundle identifier failure which doesn’t seem to go no matter what I do.

I imported it in my current project and it’s working really smooth. A million thanks for the plugin. :slight_smile:

This works like a charm.

One problem: the string doesn’t transfer to the Facebook share. This is a problem with facebook only.

I assume I need to do all the standard facebook stuff, but how do I integrate that with this code?