How can I simulate the "f" hotkey in the editor?

I want to write a script to add a menu item that, when clicked, brings the main character into focus in the Scene view. So far, I can't seem to get it or find any resources on how to change the scene view's camera position/rotation.

How can I set the position/rotation of the scene view's camera in the editor at design-time?

According to this tread:

http://forum.unity3d.com/threads/54411-Focusing-the-editor-s-Scene-camera-on-an-object-position?highlight=scene+camera

You can use:

SceneView.lastActiveSceneView.FrameSelected()

It works for me, although because it is undocumented, it is subject to not work or change.

I have mine set up as an editor script button:

if(GUILayout.Button("Frame Camera", GUILayout.Width(120)))
{
SceneView.lastActiveSceneView.FrameSelected()
}

Hope this helps!

An alternative to @noahmjohnson 's answer:

SceneView.lastActiveSceneView.SendEvent(EditorGUIUtility.CommandEvent("FrameSelected"));

For the other editor commands, refer to their name in the Edit menu of the Unity Editor window (triming spaces).

See EditorGUIUtility.CommandEvent and EditorWindow.SendEvent

Try Jaap's answer to my similar question earlier: http://answers.unity3d.com/questions/5875/how-can-i-mimic-the-frame-selected-f-camera-move-zoom-extents-zoom-to-fit

You can't at design-time, only run-time.