- Home /
Editor Windows : Help required
Hello UA Members,
For your (and my) sake ill keep it simple
I am creating a massive Custome Editor (Which i Will notify you on release) that needs Gizmos and Handles inside the editor window Not in scene or game view
If thats not possible any close alternatives
Id prefer JS but C# will work too
I just need the concepts and functions or even Links to tutorials
Answer by Bunny83 · Aug 23, 2016 at 02:08 AM
No, the Handles class is tightly bound to the sceneview. A lot methods insider the Handles class directly reference the current drawing sceneview, If not used from a SceneView callback they will throw an exception.
So you have to handle things yourself. You should be able to use the XXXCap methods to draw the usual arraws / circles / spheres / cubes ....
Thanks for the answer but I need the classes to draw other stuff in the editor window Or I cant actually mark it as correct could you tell me please
I think the part that says "you have to handle things yourself" is the correct answer....
It's a given fact that the Handles class as well as the Gizmos class is made only for the SceneView. Take PositionHandle for example. It calls the internal method "DoPositionHandle_Internal".
Inside there it uses the internal "Handles.DoPlanarHandle" 3 times (one for each axis):
position = Handles.DoPlanarHandle(Handles.PlaneHandle.xzPlane, position, rotation, handleSize * 0.25f);
position = Handles.DoPlanarHandle(Handles.PlaneHandle.xyPlane, position, rotation, handleSize * 0.25f);
position = Handles.DoPlanarHandle(Handles.PlaneHandle.yzPlane, position, rotation, handleSize * 0.25f);
Now "DoPlanarHandle" on the other hand has this snippet inside:
if (Camera.current.orthographic)
{
normalized = matrix4x.inverse.$$anonymous$$ultiplyVector(SceneView.currentDrawingSceneView.cameraTargetRotation * -Vector3.forward).normalized;
}
else
{
normalized = matrix4x.inverse.$$anonymous$$ultiplyPoint(SceneView.currentDrawingSceneView.camera.transform.position).normalized;
}
As you can see it directly uses "SceneView.currentDrawingSceneView" which isn't set when you're not curently drawing inside a sceneview. So there's no way to use those classes outside of the sceneview. That's it.
Your answer
Follow this Question
Related Questions
Showing Handles in the Game View 1 Answer
How to Draw Gizmos without using a MonoBehaviour? 2 Answers
Gizmos.DrawLine is dissapearing after returning to editor after Playing the scene 0 Answers
Gizmo equivalent of Handles.DrawSolidArc? 0 Answers
Is it possible to determine wich Handles.PositionHandle is currently focused? 1 Answer