Unity3D localscale issue

c#, scale, transform, unity-game-engine

Solution

localScale is a property so it returns a copy of the real localScale (Vector3 is a struct) Try `cell.transform.localScale = new Vector3 (scaleFactor, scaleFactor, scaleFactor);` or `cell.transform.localScale = Vector3.one * scaleFactor;`

Problem

The following code: ``` Debug.LogWarning("updating scale fix, scalefactor: "+scaleFactor+" - Current scale is: "+cell.transform.localScale.x); cell.transform.localScale.Set (scaleFactor,scaleFactor,scaleFactor); Debug.LogWarning("Scale after fix: " + cell.transform.localScale.x); ``` Produces the following output: ``` updating scale fix, scalefactor: 0.9 - Current scale is 0.8921105 UnityEngine.Debug:LogWarning(Object) Scale after fix: 0.8921105 UnityEngine.Debug:LogWarning(Object) ``` Any ideas? I would just assume that since these things are happening right after each other, the scale should be updated. Or does that happen after a frame has completed? Any help is appreciated.

Original source

Related problems