Changing gravity in-game through ProjectSettings
Hi, I'm trying to change the default gravity vector with this code:
func _on_timer_timeout() -> void:
index = (index + 1) % 4
ProjectSettings.set\_setting("physics/2d/default\_gravity\_vector", directions\[index\])
and the setting is actually changing when I print it, but the rigid and character bodies I have are not being affected in any way. Is there a step I'm missing here? It does work concretely when I change the vector directly through settings tab, but then I still can't change it by code.
The directions is an array of Vector2s: (0, 1), (0, -1), (1, 0) and so on.
Thanks for any help :)