Maaack / Godot-Game-Template

Godot template with a main menu, options menus, pause menu, credits, scene loader, extra tools, and an example game scene.
MIT License
283 stars 17 forks source link

Unwanted process: Credits are auto-scrolling while invisible #95

Closed hsandt closed 1 month ago

hsandt commented 1 month ago

Currently Credits._process just runs in the wild, even when Credits are not visible (e.g. when touching nothing on the main menu).

I noticed this when logging scrolling value (I'm working on a version that stores float scrolling to support slower scrolling, esp. important on lores pixel art games where 1px/s is very fast).

Credits should either manually return from _process when not visible, or we set its process mode to DISABLED entirely when not visible.

Ex of code hotfix:

func _process(_delta):
    if Engine.is_editor_hint():
        return
    # LOCAL FIX by hsandt to avoid scrolling Credits while invisible,
    # in the background
    if not visible:
        return
    # do stuff...