I want to create an editor component that can be added to any GameObject. The component would show a simple dropdown list of possible z-position values (-.02, -.01, 0, .01, .02 for example.)
When I select a value I want the transform’s z value to be updated with the selected value. I’d like the value to be updated within the editor just as if I set the z value directly.
The bad thing about this is that if Transform inspector is changed internally at Unity or you have plugins like NGUI running their own custom inspector, these custom editors will “collide”.
Hmm, this does provide me some insight into how thing work, but I'm really looking for something that can be applied to only "certain" GameObjects. My preference would be that it work similar to a normal unity component but update the transform while in editor mode. I would add this "editor" component to any gameobject that I want to mofify in this manner then I'd just select a value from the drop down and the Z value would change instantly. Not sure this is even possible but that is what I desire. :-)
All you need then is to have a "marker" non-editor script that you attach to those objects and write an inspector for that class that modifies the transform.
You need to work out the index or store it in the actual object, not the editor. E.g. var index = -1; for(var i = 0; i < depth.Length;i++) { if(Mathf.Approximately(depth*, t.localPosition.z)) index = i;* }
Hmm, this does provide me some insight into how thing work, but I'm really looking for something that can be applied to only "certain" GameObjects. My preference would be that it work similar to a normal unity component but update the transform while in editor mode. I would add this "editor" component to any gameobject that I want to mofify in this manner then I'd just select a value from the drop down and the Z value would change instantly. Not sure this is even possible but that is what I desire. :-)
– jeffweberAll you need then is to have a "marker" non-editor script that you attach to those objects and write an inspector for that class that modifies the transform.
– whydoidoit