2016-07-11 13 views
0

こんにちは、私はtwitterとwhatsappに詳細を分かち合うことができますが、facebookにテキストを表示しません。 Twitterやそれがない、と私はそれがゲームのスクリーンショットを取り、投稿することを追加しますので、スクリプトに追加する方法を知らないのWhatsApp私を助けてくださいUnity Sharing Facebook、Twitter、whatsappその他Android

悪い英語のため申し訳ありません

そして、ここではShareScriptです。助けのための

感謝:)

using UnityEngine; 
using System.Collections; 
using UnityEngine.UI; 
using System.IO; 

public class ShareMenu : MonoBehaviour 
{ 

    private bool isProcessing = false; 

    private string shareText = "Download This Game"; 
    private string gameLink = "Download the game on play store at " + "\nhttps://play.google.com/store/apps/details?id=com.CrazyDrivers"; 
    private string imageName = "MyPic"; // without the extension, for iinstance, MyPic 
    public void shareImage() 
    { 

     if (!isProcessing) 
      StartCoroutine(ShareScreenshot()); 

    } 

    private IEnumerator ShareScreenshot() 
    { 
     isProcessing = true; 
     yield return new WaitForEndOfFrame(); 

     Texture2D screenTexture = new Texture2D(1080, 1080, TextureFormat.RGB24, true); 
     screenTexture.Apply(); 


     string destination = Path.Combine(Application.persistentDataPath, System.DateTime.Now.ToString("yyyy-MM-dd-HHmmss") + ".png"); 
     Debug.Log(destination); 

     if (!Application.isEditor) 
     { 

      AndroidJavaClass intentClass = new AndroidJavaClass("android.content.Intent"); 
      AndroidJavaObject intentObject = new AndroidJavaObject("android.content.Intent"); 
      intentObject.Call<AndroidJavaObject>("setAction", intentClass.GetStatic<string>("ACTION_SEND")); 
      AndroidJavaClass uriClass = new AndroidJavaClass("android.net.Uri"); 
      AndroidJavaObject uriObject = uriClass.CallStatic<AndroidJavaObject>("parse", "file://" + destination); 
      intentObject.Call<AndroidJavaObject>("putExtra", intentClass.GetStatic<string>("EXTRA_STREAM"), uriObject); 
      intentObject.Call<AndroidJavaObject>("putExtra", intentClass.GetStatic<string>("EXTRA_TEXT"), shareText + gameLink); 
      intentObject.Call<AndroidJavaObject>("setType", "image/jpeg"); 
      AndroidJavaClass unity = new AndroidJavaClass("com.unity3d.player.UnityPlayer"); 
      AndroidJavaObject currentActivity = unity.GetStatic<AndroidJavaObject>("currentActivity"); 

      currentActivity.Call("startActivity", intentObject); 

     } 

     isProcessing = false; 

    } 

} 

答えて

0

は、スクリプトを試してみませんでしたが、問題は、Facebookの共有ポリシーであってもよいです。 Here is some information

ロングストーリーショートフェイスブックでは、プレフィックステキストは使用できません。 See this question

関連する問題