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

unity 5 flip problem

Discussion in 'Scripting' started by edudraz, Mar 26, 2015.

  1. edudraz

    edudraz

    Joined:
    Mar 26, 2015
    Posts:
    1
    Hello, i have a problem in unity 5, in unity 4.5 works fine.
    "mirandoADerecha" its just a bool that indicate if i am facing Right

    Code (CSharp):
    1.     void Flip() {
    2.         mirandoADerecha = !mirandoADerecha;
    3.         Vector3 thescale = Transform.localScale;
    4.         thescale.x *= -1;
    5.         Transform localScale = thescale;
    6.     }
    7.  
    The problem i get its "An object refence its required to acces non-static member 'UnityEngine.transform.localscale' "
     
  2. tobad

    tobad

    Joined:
    Mar 12, 2015
    Posts:
    90
    replace line 3 with

    Code (CSharp):
    1.  Vector3 thescale = transform.localScale;
    you used Transform ... you need transform
     
    Timelog likes this.