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.
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.
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.
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.
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)
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
ya… 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