Search Unity

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.