- Home /
Question by
user-4754 (yahoo) · Oct 06, 2010 at 09:44 PM ·
editortransformposition
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?
Comment
Answer by MSylvia · May 24, 2011 at 08:34 PM
You could create a simple editor script like so,
[CustomEditor(typeof(LockPos))]
public class LockPosEditor : Editor {
LockPos obj;
void Awake()
{
obj = target as LockPos;
}
void OnSceneGUI () {
obj.transform.position = new Vector3(0,0,0);
}
}
That would lock the GameObject that has LockPos Attached. You could then modify it more to have a toggle or lock it's current position.
Your answer
Follow this Question
Related Questions
Transform position in editor confusion (screenshot examples) 1 Answer
How is transform.position affected by scaling? 1 Answer
Get position of the closest visible vertex to mouse in scene view? 1 Answer
Object changes position/rotation, when moved (in/out of parent) in the heirarchy in the editor! 0 Answers