Lock Object Position In Editor

This might be a stupid question, but is there any way to lock an objects postiion so it can’t be move in the editor?

Here’s a really, really cracky way to do it.

Attach Lock to a gameObject and check “Locked” and you won’t be able to move it… kinda. :slight_smile:
You can drag it out of position but it should snap back. Far as I know there’s not a built in way to do it.

Lock.js

var locked : boolean = false;

private var reallyLocked :  boolean = false;
private var lockPos : Vector3;

function Start() {
	Destroy(this);
}

function OnDrawGizmos() {
	if ( locked ) {
		if ( !reallyLocked ) {
			reallyLocked = true;
			lockPos = transform.position;
		} else {
			transform.position = lockPos;
		}
	} else {
		reallyLocked = false;
	}
}