It seems in the built-in case the setter is not ever called when making the assignment, even when accessed externally. In other experiments, I had similar results for the built-in getter functions.
Obviously this isn’t too hard to work around, but it is a bit confusing. Could someone please help me understand what’s going on?
i think that is because you are printing in the ready func, basically what the engine does is setting the position to 1,1 , printing that and then it does the other stuff.
not sure tho
There is no other stuff to speak of here. The question is, why does it set the position to
(1, 1) when I have overwritten the setter to make it set position to (0, 0)
The code in the question isn’t meant to do anything; it just shows that the setter isn’t called for the line
_ready is called only the first frame so (1, 1) is correct. set_position() is a setget method for a property but you have wrote it as a custom function and not calling it anywhere.
Thanks very much for the response, but I’m afraid I still don’t fully understand. Let me clarify a bit further. According to the docs the setter for position is
set_position(value)
so I would expect it to behave like a standard setter even when overwritten. Compare the code in the original post to the following:
This code is nearly identical to the original code, but instead of overwriting the built-in setter, it defines its own. I still don’t understand why the behavior is different.
I will edit the original question to be more clear shortly. Thanks!