Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

Screenshot posting to Twitter?

Discussion in 'Scripting' started by IchBinJager, Dec 10, 2016.

  1. IchBinJager

    IchBinJager

    Joined:
    Dec 23, 2014
    Posts:
    127
    Does anyone know how I can implement support for posting screenshots to Twitter? I know about some of Unity's functions for taking screenshots but I don't know about logging into Twitter and attaching them.
     
  2. TaleOf4Gamers

    TaleOf4Gamers

    Joined:
    Nov 15, 2013
    Posts:
    825
    Well, Twitter has a REST API.
    Depending on how experienced you or someone you know is, a wrapper could be made.
    (I havent checked what the API can do.)
     
  3. passerbycmc

    passerbycmc

    Joined:
    Feb 12, 2015
    Posts:
    1,739
    instead of using the twitter Rest api, if your game is a mobile game i tend to tap into the iOS and Android internal share system using a plugin like this one. This lets you easily share to any app the user has installed.

    https://github.com/ChrisMaire/unity-native-sharing
     
  4. IchBinJager

    IchBinJager

    Joined:
    Dec 23, 2014
    Posts:
    127
    Alright. Does that support posting screenshots then? It is indeed a mobile game.
     
  5. passerbycmc

    passerbycmc

    Joined:
    Feb 12, 2015
    Posts:
    1,739
    it supports posting screenshots, but you will have to take the screenshot yourself using something like Application.Screenshot or rendering the output of a camera to a texture.

    its really easy to use once setup, toss it on a object in the scene, get e reference to it and call its Share method, with what you want the shared file to be named and with the path to the screenshot to share
     
  6. IchBinJager

    IchBinJager

    Joined:
    Dec 23, 2014
    Posts:
    127
    I will try this! I hope it's just what I needed, and not too difficult to use. Thank you!