How to use code to call 2D mode on the Scene View Control Bar

43604-sceneviewcontrolbar.png
How to use code to call 2D mode API on the Scene View Control Bar ? I did’t find the relevant information in the document.Please Help me ,thanks

info pic from :Unity - Manual: Scene view View Options toolbar

Hi

You just need to use this on the Editor Script:

SceneView.currentDrawingSceneView.in2DMode

You can ask or set this bool.

#if UNITY_EDITOR

        UnityEditor.SceneView sceneView = UnityEditor.SceneView.currentDrawingSceneView;
		          sceneView.in2DMode= true;

#endif

Ok .all right