start a scene or game without a play button

Hi friends, is there a way to test a game without pressing play on GUI button, ie game runs regardless of gui or gui play button

if i press play it works fine but is there a way for the game to be running without pressing play button each time the scene starts?

so ie: scene starts / game is running and user can continue to play (no need for gui)

thanks in advance

Ok to avoid repeating it lots of times, lets call the code you are running on your play button “ButtonCode”

If you want something to happen the moment the scene loads, then you could do one of two things.
One is to place an object in the scene you are loading and place the ButtonCode in the “Awake” method of this object. So Scene Loads > Awake Called > ButtonCode runs

Alternatively you could write then you can write a script that responds to the scene loaded event from the unity SceneManager (you can subscribe to an event that gets called everytime a scene is loaded) and put your ButtonCode in there instead. So SceneLoads > SceneManager calls SceneLoaded event > ButtonCode runs.

Now if you are talking about trying to just avoid pressing the play button in the editor? then I would first deeply question why you would want to do this at all, however if you really did want to do that you could probably use the second approach to detect scene loading in the editor and automatically enter play mode from there, in that case two links to help you on your way would be the EditorSceneManager and the EditorApplication.isPlaying documentation.

Hope this helps.