Hi,
For an editor tool I’d like to make a button change the currently selected object to
have it’s Rotation set from whatever it is to 0,0,0 or 1,1,1
I can figure out how to detect the currently selected object,
but how do I code to set the rotation, position or scale to these custom values.
Just rotation will, do I can figure out how to replace the rest if there isn’t much
difference in function…
How do I code to…
1.) Recognise the currently selected object. (Got I think)
2.) Take whatever that objects rotations are along the x,yz
and make each of them Equal zero.
If you look into the scripting reference you should have found the Selection class. It holds the current selection. In your case you need something like:
if (Selection.activeTransform != null)
Selection.activeTransform.localRotation = Quaternion.identity;