private void secondColumnButtonsGUI() { // only show posting actions if we have permission to do them if (_hasPublishActions) { if (GUILayout.Button("Post Image")) { var pathToImage = Application.persistentDataPath + "/" + FacebookGUIManager.screenshotFilename; #if UNITY_EDITOR pathToImage = Application.dataPath.Replace("Assets", screenshotFilename); #endif if (!System.IO.File.Exists(pathToImage)) { Debug.LogError("there is no screenshot available at path: " + pathToImage); return; } var bytes = System.IO.File.ReadAllBytes(pathToImage); Facebook.instance.postImage(bytes, "im an image posted from iOS", completionHandler); } if (GUILayout.Button("Post Message")) { Facebook.instance.postMessage("im posting this from Unity: " + Time.deltaTime, completionHandler); } if (GUILayout.Button("Post Message & Extras")) { Facebook.instance.postMessageWithLinkAndLinkToImage("link post from Unity: " + Time.deltaTime, "http://prime31.com", "Prime31 Studios", "http://prime31.com/assets/images/prime31logo.png", "Prime31 Logo", completionHandler); } } else { GUILayout.Label("Reauthorize with publish_actions permissions to show posting buttons"); } if (GUILayout.Button("Graph Request (me)")) { Facebook.instance.getMe((error, result) => { // if we have an error we dont proceed any further if (error != null) { return; } if (result == null) { return; } // grab the userId and persist it for later use _userId = result.id; Debug.Log("me Graph Request finished: "); Debug.Log(result); }); } if (GUILayout.Button("Show stream.publish Dialog")) { // parameters are optional. See Facebook's documentation for all the dialogs and parameters that they support var parameters = new Dictionary <string, string> { { "link", "http://prime31.com" }, { "name", "link name goes here" }, { "picture", "http://prime31.com/assets/images/prime31logo.png" }, { "caption", "the caption for the image is here" } }; FacebookBinding.showDialog("stream.publish", parameters); } if (GUILayout.Button("Show apprequests Dialog")) { // see Facebook's documentation for all the dialogs and parameters that they support var parameters = new Dictionary <string, string> { { "title", "This Is The Title" }, { "message", "message goes here" } }; FacebookBinding.showDialog("apprequests", parameters); } if (GUILayout.Button("Get Friends")) { Facebook.instance.getFriends(completionHandler); } if (_canUserUseFacebookComposer) { if (GUILayout.Button("Show Facebook Composer")) { // ensure the image exists before attempting to add it! var pathToImage = Application.persistentDataPath + "/" + FacebookGUIManager.screenshotFilename; if (!System.IO.File.Exists(pathToImage)) { pathToImage = null; } FacebookBinding.showFacebookComposer("I'm posting this from Unity with a fancy image: " + Time.deltaTime, pathToImage, "http://prime31.com"); } } if (GUILayout.Button("Show Facebook Share Dialog")) { var parameters = new Dictionary <string, object> { { "link", "http://prime31.com" }, { "name", "link name goes here" }, { "picture", "http://prime31.com/assets/images/prime31logo.png" }, { "caption", "the caption for the image is here" }, { "description", "description of what this share dialog is all about" } }; FacebookBinding.showFacebookShareDialog(parameters); } }