Friday, 22 August 2014

Sharing results to Facebook Using Unity3d


Sharing results to Facebook  

1.open facebook developer website click on app tab >create a new app fill all the details including app domain

 2.Get an app id and use that id in given Script. 

 const string appId="14012223232";
 const string fbUrl="http://www.facebook.com/dialog/feed"; 

  public static void share(string link,string pictureLink,string name,string caption,string  description,string redirect) 
 {
     Application.OpenURL(fbUrl +
     "?app_id="+appId 
     +"&link="+WWW.EscapeURL(link) 
     +"&picture="+WWW.EscapeURL(pictureLink)
     +"&name="+WWW.EscapeURL(name)
     +"&caption="+WWW.EscapeURL(caption)
     +"&description="+WWW.EscapeURL(description)
     +"&redirect_uri="+redirect); 
}


 3.to share just use 

classname.share(("https://www.somewebsitename.com", "http://www.pictureLinkWebsite.com", "Game Title", "caption", "Player High Score:1200000", "https://www.somewebsitename.com"); 


//redirect website should have  same app domain