+1 vote

Hello :)
I have the following situation: I have a custom node with a script attached to it, which defines certain exported values, so they are editable inside the editor UI.
Those variables have a setter function which in turn changes certain other values on the same node.
When I edit the values in the editor UI (under "Script Variables") in the "prefab" (custom node) itself, it does update the values I change in code on another object on the same node (shader uniform parameter) as well. But when I instance the given custom node in another scene, and edit the values in the editor UI again, the values of the variables in the script do change, but it doesn't update the other values (shader param's) on the same node, like it does, when I change the values in the custom node (not instanced) itself.

Is that a "bug", or is that intentionally?

For a better understanding, here are some screenshots and code snippets, to better showcase what I mean:

Code snippet for both cases the same:

export (Vector2) var texture_scale = Vector2(1, 1) setget _set_texture_scale
func _set_texture_scale(value):
    texture_scale = value
    self.material.set_shader_param("uv_scale", Vector3(texture_scale.x, texture_scale.y, 0))

When I edit the values in the custom node itself (not instanced in another scene)
enter image description here
enter image description here

When I edit the values on an instanced node of the custom node (with editable children activated)
enter image description here
enter image description here

I hope you can help me understanding, why that shouldn't just work the same as the first one. Or if there is a better way, to handle those situations. Thank you very much in advance. I hope you all have a stress-free sunday.

Godot version v.3.2.3.stable.official
in Engine by (21 points)

Please log in or register to answer this question.

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.