I want to draw a line from my object at run time (debug.DrawLine). To see this line, I should use the scene view, let’s say that I split my monitor, so it show the GameView and the SceneView at the same time, the problem is that in the game view, I want to move the object (using the arrow keys) and I want to see the line in the scene view, but the object is moving fast, so it will be out of view in the SceneView, and I find myself pressing f rapidity in the SceneView to bring the object into the view again. is there any way to make this happen in the script ?
To lock the view to a game object, select it in the Hierarchy and press Shift+F.
(Alternatively, you can select Edit → Lock View to Selected
.)
Put this in the update function of the gameobject that you want to keep in view.
SceneView.lastActiveSceneView.FrameSelected();
Disclaimer: Undocumented API is not officially supported and subject to change at anytime.
Good luck.