SceneView focus the currently selected item

Editor code as follows:

Selection.activeGameObject = indexer;

// 方法一
SceneView.FrameLastActiveSceneView();

// 方法二
EditorApplication.ExecuteMenuItem("Edit/Frame Selected");

// 方法三
if (SceneView.lastActiveSceneView != null)
    SceneView.lastActiveSceneView.Frame(new Bounds(worldPos, Vector3.one * frameHeight), false);

 

Guess you like

Origin www.cnblogs.com/sifenkesi/p/11346667.html