Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by Jammer3000 · Dec 16, 2014 at 03:46 AM · c#facebooksocial

Unity Social Integration - Facebook Button Not Working?

Hi I have a game that pops up a Facebook button when the game ends so the user can share their highscore (kinda like a flappy bird simple game). The Facebook button works. Alls this does is when the button is clicked take the user to the Facebook app on their iOS device and take them directly to post area of the Facebook app and already have text they can post in their for them which is what it is doing. But in the picture below you will see that it doesn't put the text in the area i want it to (area with red circle) it puts it in that box thing? I want all that text just to be in the area marked by red?

alt text

I am not using any plugins either and please don't suggest any as I do not want to use anything beside the Unity Facebook SDK.Thanks in advance (:

 using UnityEngine;
 using System;
 using System.Collections;
 using System.Collections.Generic;
 using System.Linq;
 
 public class FacebookButton : MonoBehaviour {
     
     protected string lastResponse = "";
     protected Texture2D lastResponseTexture;
 
     public GameObject currentScoreGui;
 
     
     void Start () {
         CallFBInit();
     }
     
     void OnMouseUp ()
     {
         Debug.Log("Finger lifted off Facebook button...");
         if (gameObject.tag == "UIFacebook") {
             
             CallFBLogin();
             
             if (FB.IsLoggedIn) {
                 // Call feed post
                 CallFBFeed();
                 Debug.Log("Feed has been called...");
             }
             Debug.Log("Facebook Button Pressed...");
         }
     }
     
     
     
     #region FB.Feed() example
 
     public bool IncludeFeedProperties = false;
     private Dictionary<string, string[]> FeedProperties = new Dictionary<string, string[]>();
     
     private void CallFBFeed()
     {
         Dictionary<string, string[]> feedProperties = null;
         if (IncludeFeedProperties)
         {
             feedProperties = FeedProperties;
         }
         FB.Feed(
             toId: "",
             link: "",
             linkName: "Jump Now! = linkName",
             linkCaption: "Jump Now! Is such a cool game = linkCaption",
             linkDescription: "I've just scored" + currentScoreGui.guiText.text + " points in #JumpNow! Download it from the @AppStore and try to beat me! https://itunes.apple.com/us/artist/john-pagley/id840382873 = linkDescription",
             picture: "",
             mediaSource: "",
             actionName: "",
             actionLink: "",
             reference: "",
             properties: feedProperties,
             callback: Callback
             );
     }
     
     #endregion
     
     void Awake()
     {
         FeedProperties.Add("key1", new[] { "valueString1" });
         FeedProperties.Add("key2", new[] { "valueString2", "http://www.facebook.com" });
     }
     
     #region FB.Init() example
     
     private void CallFBInit()
     {
         FB.Init(OnInitComplete, OnHideUnity);
     }
     
     private void OnInitComplete()
     {
         Debug.Log("FB.Init completed: Is user logged in? " + FB.IsLoggedIn);
     }
     
     private void OnHideUnity(bool isGameShown)
     {
         Debug.Log("Is game showing? " + isGameShown);
         FbDebug.Log("OnHideUnity");                                                              
         if (!isGameShown)                                                                        
         {                                                                                        
             // pause the game - we will need to hide                                             
             Time.timeScale = 0;                                                         
         }                                                                                        
         else                                                                                     
         {                                                                                        
             // start the game back up - we're getting focus again                                
             Time.timeScale = 1;                                                                  
         }   
     }
     
     #endregion
     
     #region FB.Login() example
     
     private void CallFBLogin()
     {
         FB.Login("email,publish_actions", LoginCallback);
     }
     
     void LoginCallback(FBResult result)
     {
         if (result.Error != null)
             lastResponse = "Error Response:\n" + result.Error;
         else if (!FB.IsLoggedIn)
         {
             lastResponse = "Login cancelled by Player";
         }
         else
         {
             lastResponse = "Login was successful!";
         }
     }
     
     private void CallFBLogout()
     {
         FB.Logout();
     }
     #endregion
     
     protected void Callback(FBResult result)
     {
         lastResponseTexture = null;
         // Some platforms return the empty string instead of null.
         if (!String.IsNullOrEmpty (result.Error))
         {
             lastResponse = "Error Response:\n" + result.Error;
         }
         else if (!String.IsNullOrEmpty (result.Text))
         {
             lastResponse = "Success Response:\n" + result.Text;
         }
         else if (result.Texture != null)
         {
             lastResponseTexture = result.Texture;
             lastResponse = "Success Response: texture\n";
         }
         else
         {
             lastResponse = "Empty Response\n";
         }
     }
 }


img_4327.png (53.1 kB)
Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

1 Reply

· Add your reply
  • Sort: 
avatar image
1
Best Answer

Answer by digzou · Dec 22, 2014 at 02:19 PM

As far as I know you cannot "prefill" [canned text] that text box. Facebook doesnt allow you to do this according to its policies.User can only populate that text box. I had one of my android native app rejected from facebook for doing what you intend to do. How I go about now is, I prefill whatever I want to in the description and caption of the feed.

Hope this helps :)

alt text


fb feed.jpg (33.9 kB)
Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

28 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Posting To Twitter From App? - Unity 3 Answers

Why Does My GameObject Not Spawn Anymore? 2 Answers

How may I get the children (direct and dependents) of a game object? 2 Answers

Selecting and deselecting not working 0 Answers

How to call Variable across scripts. 2 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges