How to increase / decrease the size of objects in Unity?
Example:
public GameObject sprite;public float scale = 2.0f;void ScaleResolution (){sprite = sprite * scale; // epic string!}
public GameObject sprite;
public float scale = 2.0f;
void ScaleResolution ()
{
sprite = sprite * scale; // epic string!
}
This is a component property. transform
transform
sprite.transform.localScale = new Vector3(2.0f, 2.0f, 2.0f);
Position, rotation, and scale are transformation properties, so you need to change if:
public GameObject sprite; public float scale = 2.0f; void ScaleResolution() { sprite.transform.localScale = new Vector3(scale, scale, scale); }