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 Mirakulous · Sep 07, 2014 at 02:31 PM · c#facebook

Facebook share an invite overload error

Hi guys, i'm having trouble with my invite and share buttons. unity won't build due to not having overloads for the functions.

i've attached the script im using below so if anyone can help find the issue that would be great. i've highlighted the part of code which the compiler doesn't like.

Here's the facebook manager script using UnityEngine; using System.Collections;

public class FacebookManager {

 public static bool IsInitialized = false;
 public static string Permissions = "basic_info,publish_actions";

 public static void Initialize() {
     if(!IsInitialized) {
         FB.Init(() => { IsInitialized = true; }, (bool IsGameShown) => {
             if(!IsGameShown) {
                 Time.timeScale = 0;
             } else {
                 Time.timeScale = 1;
             }
         });
     }
 }

 public static bool IsAuthenticated {
     get {
         return FB.IsLoggedIn;
     }
 }

 public static void Authenticate() {
     if(IsAuthenticated) {
         Debug.Log("Facebook is already authenticated!");
         return;
     }
     FB.Login(Permissions, (FBResult result) => {
         if(result.Error != null) {
             Debug.Log("Facebook Login Error: " + result.Error);
         }
     });
 }

this is what the compiler doesnt like for the invite function public static void Invite(string inviteTitle, string inviteMessage) { if(IsAuthenticated) { FB.AppRequest(inviteMessage, null, "", null, null, "", inviteTitle, null); } else { AuthenticateAndInvite(inviteTitle, inviteMessage); } }

and this is what the compiler doesnt like for the share function public static void Share(string name, string caption, string description, string image, string url) { if(IsAuthenticated) { FB.Feed("", url, name, caption, description, image, "", "", "", "", null, null); } else { AuthenticateAndShare(name, caption, description, image, url); } }

 private static void AuthenticateAndInvite(string inviteTitle, string inviteMessage) {
     if(IsAuthenticated) {
         Debug.Log("Facebook is already authenticated!");
         return;
     }
     FB.Login(Permissions, (FBResult result) => {
         if(result.Error != null) {
             Debug.Log("Facebook Login Error: " + result.Error);
         } else if(IsAuthenticated) {
             Invite(inviteTitle, inviteMessage);
         }
     });
 }

 private static void AuthenticateAndShare(string name, string caption, string description, string image, string url) {
     if(IsAuthenticated) {
         Debug.Log("Facebook is already authenticated!");
         return;
     }
     FB.Login(Permissions, (FBResult result) => {
         if(result.Error != null) {
             Debug.Log("Facebook Login Error: " + result.Error);
         } else if(IsAuthenticated) {
             Share(name, caption, description, image, url);
         }
     });
 }

}

Here is the invite script

using UnityEngine; using System.Collections;

public class FacebookInvite : MonoBehaviour {

 void Update () {
     if(isTouched()) {
         FacebookManager.Invite("Play Zombies with me!", "Check out this new game.");
     }
 }

 public bool isTouched() {
     bool result = false;
     if(Input.touchCount == 1) {
         if(Input.touches[0].phase == TouchPhase.Ended) {
             Vector3 wp = Camera.main.ScreenToWorldPoint(Input.GetTouch(0).position);
             Vector2 touchPos = new Vector2(wp.x, wp.y);
             if (collider2D == Physics2D.OverlapPoint(touchPos)) {
                 result = true;
             }
         }
     }
     if(Input.GetMouseButtonUp(0)) {
         Vector3 wp = Camera.main.ScreenToWorldPoint(Input.mousePosition);
         Vector2 mousePos = new Vector2(wp.x, wp.y);
         if (collider2D == Physics2D.OverlapPoint(mousePos)) {
             result = true;
         }
     }
     return result;
 }

}

and here is the share script

using UnityEngine; using System.Collections;

public class FacebookShare : MonoBehaviour {

 void Update () {
     if(isTouched()) {
         FacebookManager.Share("Check out my latest run of zombies!", "I have a high score of " + (PlayerPrefs.GetInt("highscore", 0)).ToString() + " points.  Can you beat me?");
     }
 }

 public bool isTouched() {
     bool result = false;
     if(Input.touchCount == 1) {
         if(Input.touches[0].phase == TouchPhase.Ended) {
             Vector3 wp = Camera.main.ScreenToWorldPoint(Input.GetTouch(0).position);
             Vector2 touchPos = new Vector2(wp.x, wp.y);
             if (collider2D == Physics2D.OverlapPoint(touchPos)) {
                 result = true;
             }
         }
     }
     if(Input.GetMouseButtonUp(0)) {
         Vector3 wp = Camera.main.ScreenToWorldPoint(Input.mousePosition);
         Vector2 mousePos = new Vector2(wp.x, wp.y);
         if (collider2D == Physics2D.OverlapPoint(mousePos)) {
             result = true;
         }
     }
     return result;
 }

}

thanks in advanced

Comment
Add comment · Show 1
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
avatar image gjf · Sep 07, 2014 at 05:15 PM 0
Share

your highlighting of the potentially erroneous code has destroyed the formatting making it extremely hard to read. consider fixing it... also, what are the specific error messages (with line numbers)?

2 Replies

· Add your reply
  • Sort: 
avatar image
0

Answer by digibawb · Sep 07, 2014 at 05:58 PM

The latest Facebook SDK changed the AppRequest method, so the 3rd parameter is now a list of objects, not a string, so what you are passing is no longer valid (assuming you're on the 6.0 SDK anyway!).

The documentation still references the old version, unfortunately.

The FB.Feed looks correct to me at a glance, but you might want to check against what that method expects as well.

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
avatar image
0

Answer by Mirakulous · Sep 07, 2014 at 08:02 PM

sorry this is the error i get

error CS1501: No overload for method AppRequest' takes 8' arguments

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

23 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

Related Questions

Facebook SDK Multi-friend-selector 1 Answer

Openssl not found in unity sdk for facebook 6 Answers

Facebook SDK focus. 1 Answer

Multiple Cars not working 1 Answer

I can see/send invites to non-app user friends on canvas app but not on android/ios 0 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