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

Flipping Documentation Request

Discussion in 'Documentation' started by Disalvo, Feb 25, 2016.

  1. Disalvo

    Disalvo

    Joined:
    Aug 19, 2015
    Posts:
    2
    Hi, So... I just wanted to put this out there, I know it doesn't help the fact that I am a newbie when it comes to coding but. I have not found much on how to use the new Flipping in the Sprite Renderer rather than a negative Scale to flip sprites. I can only find this in the Unity Manual: http://docs.unity3d.com/ScriptReference/SpriteRenderer-flipX.html

    and this in the API Documentation: http://docs.unity3d.com/ScriptReference/SpriteRenderer-flipX.html

    Not really much in how to use it in code,
    It would be great to see an example in the documentation such as Light in the API:

    http://docs.unity3d.com/ScriptReference/Light.html

    So... Yes, Just a Request. Thank you for your time. :)
     
  2. feiting

    feiting

    Joined:
    Oct 26, 2012
    Posts:
    33
    This is separate because of the keyword "Rendering" "Only rendering is affected" It means your sprite is perfectly unaffected, it only mirrors itself for display. This way you can mirror objects in complex objects/hierarchies without affecting everything attached
     
  3. duck

    duck

    Unity Technologies

    Joined:
    Oct 21, 2008
    Posts:
    358
    Noted! We have rather a lot of pages in the scriptref without code examples right now, we're trying to improve that.

    You should be able to use this to use the flipX and flipY properties in code:

    GetComponent<SpriteRenderer>().flipX = true;
     
  4. bayerly

    bayerly

    Joined:
    Apr 9, 2013
    Posts:
    25
    Just to be clear, the above script that duck posted above is using C# (I believe) - for Unityscript you'd add a '.' following 'GetComponent' as below:

    GetComponent.<SpriteRenderer>().flipX = true;