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?


1 Answer 1


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;

public class EditingScaleInEditMode : MonoBehaviour {

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

        //TODO calcualtions
        //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.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .