# Locking or overriding game object scale property coordinates in inspector window

I want to know if it is possible to lock or override the X and Y coordinates of the scale property in the inspector window so that changing one coordinate immediately changes the other and scrubbing through one coordinate changes the value of the other. If yes, how can it be done?

For doing that, you'll need to create something called "Editor script". This is a script (Here: MonoBehaviour) that's being executed in the Editor. In this script you access the Transform component of the object and modify the scale value (Vector3). Here's some example code:

using System.Collections;
using UnityEngine;

[ExecuteInEditMode]
public class EditingScaleInEditMode : MonoBehaviour {

void Update() {
int x = transform.localScale.x;
int y = transform.localScale.y;

//TODO calcualtions
//example:
//y = x*x;

transform.localScale = new Vector3(x, y, transform.localScale.z);
}
}


Just copy and paste this code into a file called EditingScaleInEditMode.cs and add as a Component to an active GameObject in the hierachy.