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 · Nov 26, 2014 at 12:59 AM · c#socialtwitter

Posting To Twitter From App? - Unity

Hi Jeremy here, and the script below is what i am using to have my users post to Twitter in my mobile game and how it works is when the user taps the screen it opens Twitter in the browser on their mobile device with the text that I specify (text param of "Share" method) asking them to login and let it post the text to their wall. I want it to open the Twitter "app" on their mobile device so they can do it from there instead of doing it from their browser on their mobile device. Note I have Lets Tweet from the unity asset store in this project if that would make a difference. Thank you very much in advance (:

Also this link is where I got this code and may help if you don't understand why its working: http://getencapsulated.com/sharing-results-to-twitter-or-facebook/

 using UnityEngine;
 using System.Collections;
 
 public class TwitterButton : MonoBehaviour {
     
     const string Address = "http://twitter.com/intent/tweet";
     
     public static void Share(string text, string url,
                              string related, string lang="en")
     {
         Application.OpenURL(Address +
                             "?text=" + WWW.EscapeURL(text) +
                             "&url=" + WWW.EscapeURL(url) +
                             "&related=" + WWW.EscapeURL(related) +
                             "&lang=" + WWW.EscapeURL(lang));
     }
     void Update () {
         
         if (Input.GetButtonDown("Fire1")) {
             
             Share("Check out this cool game and share on Twitter. Jump Now!", "http://apps.cettatech.com", "", "en");
             Debug.Log("Twitter Button Pressed...");
         }
     }
 
 }
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 Jammer3000 · Nov 26, 2014 at 07:50 PM 0
Share

Also a script or something that someone has used to talk to the Twitter API would be very helpful.

3 Replies

· Add your reply
  • Sort: 
avatar image
2

Answer by Sujil-V-S · Jul 11, 2016 at 09:42 AM

I found one plugin.

https://www.assetstore.unity3d.com/en/#!/content/536

Check if it is useful.

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
-1

Answer by SimenZhor · Nov 21, 2015 at 07:46 PM

I have no experience with this functionality, but I am quite sure Twitter themselves have some sort of functionality for developers to implement into their software after registering as a developer at their site.

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 ahaugaa · Jan 30, 2015 at 03:29 AM

I know this doesn't open the Twitter app like you requested, but if you're trying to avoid opening the browser for every post to Twitter, this might help.

I just started working with Let's Tweet (recently updated to work with Twitter API 1.1) and from what I've built off of their example, the user would only have to open a browser once to initially authorize your Unity app to post to their account. From that point on, you can save their necessary account info (for example in PlayerPrefs) and have direct access to posting tweets from within the Unity app.

If you especially want to use the Twitter app, you could try writing a plugin (for Android) that creates an Intent Chooser dialog with an ACTION_SEND intent and filter for the Twitter app, as described in this StackOverflow thread.

I'm not familiar with any equivalents for iOS, sorry.

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

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

Related Questions

Application.OpenURL Won't Open Url With Custom String? 1 Answer

Unity Social Integration - Facebook Button Not Working? 1 Answer

How big is too big? Terrain Question. 1 Answer

How to transfer colllider from OnTriggerEnter to Update 1 Answer

Help| Convert a javascript to C# 1 Answer


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