Is the MainLoop supposed to run while the game is not running?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By mburkard

I’m running into a problem with the Godot application where the _physics_process function of my scene is being called while my game is not running.

For example, If I have:

func _physics_process(delta: float):

My output will be flooded with 0.016667 even while my project is not being played.

The MainLoop Documentation says:

Upon the application start, a MainLoop implementation must be provided to the OS; otherwise, the application will exit.

I would think this means that the OS is passing a main loop implementation for the engine to use when you play a scene, not while you’re using the Godot application.

I’ve made a scene for a character with keyboard controls.

func _physics_process(delta: float):
	if Input.is_action_pressed("ui_up"):
		move_and_slide(global_transform.basis.z * speed)

My character will move around in the scene while I’m typing in the script editor since I’m occasionally hitting movement keys while coding. This feels very wrong.

Am I misunderstanding something or is this a bug?
Thank you for any help.

:bust_in_silhouette: Reply From: jgodfrey

It sounds like your script has been defined as a tool script - which is intended to run inside the editor.

Does your script have the tool keyword at the top? If so, that’s the issue. See here for more info: