Press play (in editor) but with scripting API

Hello guys!

I want to automatizes lot of things without any use of the graphical interface and in my routine in need to press the play button in the editor mode to play the loaded scene, is there a scripting API that allows this?

I have looked at SceneManager but didn’t found any methods interesting.
https://docs.unity3d.com/ScriptReference/SceneManagement.SceneManager.html

thx in advance!

EditorApplication class has what you’re looking for.

EditorApplication.EnterPlaymode:

EditorApplication.isPlaying:

2 Likes

Wow fast and precise, that’s what I was looking for !
thx