unity editor in play mode code example
Example: editor play mode in unity through scripting
[MenuItem("Play/PlayMe")]
public static void BuildAssetBundles()
{
EditorApplication.isPlaying = true;
/*EditorApplication.NewScene();
GameObject go = new GameObject("PlayMode");
go.AddComponent<PlaySomeMonoBehaviour>().WhatToDo = PlaySomeMonoBehaviour.PlayMe;*/
}