Game Development Reference
In-Depth Information
Listing 8.15 Displaying Your Profile Picture in Unity
var t: Texture2D;
var MagicToken = "";
...
function RequestUserDetails()
{
if(MagicToken != "")
{
UFacebook.MagicToken = MagicToken;
UFacebook.GetUserProperty("me", "link");
GetDisplayPicture();
}
return null;
}
...
function OnGUI()
{
...
scrollViewVector = GUI.BeginScrollView
(Rect (250,10,400, 400),
scrollViewVector, Rect
(0, 0, 600, 600));
UFacebook.LastRequest = GUI.TextArea
(Rect (0, 0, 600, 600),
UFacebook.LastRequest);
GUI.EndScrollView();
if(profilePic != null)
GUI.Button (Rect (10,155, 100, 100), profilePic);
}
function GetDisplayPicture()
{
var username = UFacebook.username;
if( username != "")
{
var www : WWW = new WWW (" http://graph.
facebook.com/ " + username +
"/picture");
yield www;
profilePic = www.texture;
}
}
Search Nedrilad ::




Custom Search