Is there a IsRunning or IsPlaying type flag to determine if you are in play mode or in the editor?
Application.isPlaying. Just as a note, the scripting docs do have a search function.
Did you even look into the documentation? It’s a mystery how you missed that.
ps. keep in mind that all this stuff belongs to the editor namespace. If you use it in normal game script you can’t build your game. Make sure to surround all editor functions with
#if UNITY_EDITOR
// editor stuff
#endif
if you want to use editor functions inside a game script.
For more information see: Conditional compilation