【Unity ライブラリ】Mobile Social Plugin
Mobile Social Plugin
https://www.assetstore.unity3d.com/en/#!/content/15066
using UnityEngine; using System.Collections; public class SosialShareManager : MonoBehaviour { Texture2D ss; public GameObject ShareParent; #region Mono void Start () { ss = new Texture2D( Screen.width, Screen.height, TextureFormat.RGB24, false ); ShareParent.SetActive(false); } public void PopShare(){ ShareParent.SetActive(true); AudioManager.instance.ButtonOKSound(); } public void HideShare(){ ShareParent.SetActive(false); AudioManager.instance.ButtonBackSound(); } #endregion #region Logic public void ScreenShot() { StartCoroutine(TakeImage()); } //スクリーンショット(insgram,twitter) private IEnumerator TakeImage() { yield return new WaitForEndOfFrame(); // Read screen contents into the texture ss.ReadPixels( new Rect(0, 0, Screen.width, Screen.height), 0, 0 ); ss.Apply(); } public void ShareToInstagram() { ScreenShot (); SPInstagram.instance.Share (ss, "#Toilet Squad"); ShareParent.SetActive(false); } public void ShareToTwitter() { ScreenShot (); SPShareUtility.TwitterShare("#Toilet Squad", ss); ShareParent.SetActive(false); } #endregion }