inside OnSceneGUI to draw a clickable button in the scene view. What is the rotation ‘rot’ if I want the button to always face directly toward the scene view (not the camera) in design time?
By scene view I mean what I actually see in the scene while I am dragging, rotating the scene. So I want the buttons to always looks head-on when I rotate the scene.
Your code works beautifully! It is exactly what I need!
I don’t believe this is correct. Camera.current refers to the currently drawing camera. SceneView.lastActiveSceneView refers to the SceneView that was most recently in focus. If you have multiple scene tabs open, then all of the buttons being drawn (in each scene view) will all face towards the camera you moved most recently, rather than the camera that is currently drawing that scene.
Is there an issue with Camera.current that prevents its use in more recent versions of Unity?
Ah, if you want to do multiple scene views you can use SceneView.currentDrawingSceneView to make the direction local to the individual scene viewports. If we want to render to just one view, there are options to check the exact view before rendering with SceneView.sceneViews. I believe SceneView was added for better support with UI Elements back in 2018.2, but can be used anywhere. It also gives access to more of the scene camera features that such as focusing on a target and changing near/far planes.
I’ve found Camera.current to be a bit finicky to work with, but if it works, it works. I just expect it may eventually become depreciated with IMGUI in the coming years as UI Toolkit becomes the standard workflow for editor tooling.