Screen.SetResolution in IDE

I want to try running my project at different window sizes to see how it affects CPU usage / framerate.

Is it possible to use Screen.SetResolution within the IDE preview (Play/⌘+P) to resize? The window does not resize no matter what settings I choose (eg standalone, free aspect). However Screen.SetResolution works fine when the project is built and run.

Also, can you detect when the project is running in preview vs desktop?

Screen.SetResolution does not work in the editor; instead you select different resolutions from the drop-down menu or manually resize the game view. Use Application.isEditor to see if you’re in the editor. (IDE is not really the correct term for the Unity editor since coding is done in an external app; you could use IDE to describe MonoDevelop or Visual Studio.)