- Home /
How to read the current PivotRotation or PivotMode ?
Hi there
How can I find out from code in an editor script, if the Global or Local PivotRotation is selected?
I searched some time now, but did not find something useful.
Answer by luizgpa · Jan 03, 2012 at 05:23 PM
There's a undocumented class in UnityEditor namespace called Tools. It has a static property pivotRotation, that returns a PivotRotation enum (Local or Global) and another one called pivotMode, that returns a PivotMode enum (Center or Pivot).
public class Tools : ScriptableObject
{
//(...)
public static ViewTool viewTool { get; set; }
public static PivotMode pivotMode { get; set; }
public static PivotRotation pivotRotation { get; set; }
public static Vector3 handlePosition { get; }
public static Quaternion handleRotation { get; set; }
public static Quaternion handleLocalRotation { get; }
//(...)
}
Thank you very much Luiz!
Seems I didn't dig deep enough myself. I found only the enums.
Wish U a happy new year!
Thanks! For you too!
Using a disassembler was easy to find that.
HEY Unity, why U no document your stuff?
@luizgpa that's some good sarcasm there, have an upvote
Just popping by that it's 2018 and this is still undocumented... You're a life saver!
Your answer
Follow this Question
Related Questions
Custom Handle. Mutliple Objects 0 Answers
PositionHandle causing problems 0 Answers
How to disable the default transform gizmo in editor? 1 Answer
Handles.matrix seems strange? 2 Answers
Keep multiple custom handles visible in the Scene view 0 Answers