All Questions

Community

K
Orestis Konstantinidis
posted to: 2D Reflections

Shader Parameters don't update their UI

Hi, this is a question about the "Taking scale and zoom into account" part. Everything works as expected except for the fact that the Godot UI doesn't update the shader values in the Inspector. When I zoom in the view, or when I scale the sprite, the values don't reflect the change.

This seems to be an update problem with Godot, as when I change scenes and come back they refresh and show their true value.

Is that a limitation of Godot? Is there a known way around it? It would be useful to see the true value of the Shader Parameters for debugging easier.

  • Nathan Lovato replied

    That's normal. It's how the inspector works, but also retained UI in general in many programs. Normally, you change a value from the UI and something happens in the view, not the other way around (i.e. changing the program's state from code).

    To get real-time updates you can add code that refreshes the properties when some notification occurs (I don't know if there's one on the root viewport for when the view changed. Otherwise, you can update the properties every frame in _process(), while in the editor.

    func _process(delta):
    		if Engine.editor_hint:
    				set_some_property(...)