private IEnumerator PostScreenshot() { yield return(new WaitForEndOfFrame()); // Create a texture the size of the screen, RGB24 format int width = Screen.width; int height = Screen.height; Texture2D tex = new Texture2D(width, height, TextureFormat.RGB24, false); // Read screen contents into the texture tex.ReadPixels(new Rect(0, 0, width, height), 0, 0); tex.Apply(); SPShareUtility.TwitterShare(text, tex); Destroy(tex); dispatch(BaseEvent.COMPLETE); }
private IEnumerator TwitterScreenshot() { yield return(new WaitForEndOfFrame()); // Create a texture the size of the screen, RGB24 format int width = Screen.width; int height = Screen.height; Texture2D tex = new Texture2D(width, height, TextureFormat.RGB24, false); // Read screen contents into the texture tex.ReadPixels(new Rect(0, 0, width, height), 0, 0); tex.Apply(); #if UNITY_IPHONE SPShareUtility.TwitterShare("I just scored " + GameManager.Instance.LatestScore + " in a game of " + gameHashtag + " on iOS. Can you beat it?", tex); #elif UNITY_ANDROID SPShareUtility.TwitterShare("I just scored " + GameManager.Instance.LatestScore + " in a game of " + gameHashtag + " on Android. Can you beat it?", tex); #endif Destroy(tex); }
private void PostImage() { SPShareUtility.TwitterShare("This is my text to share", ImageToShare); }
private void PostMSG() { SPShareUtility.TwitterShare("This is my text to share"); }