|Attention||Topic was automatically imported from the old Question2Answer platform.|
I’m trying to use get() on a vector path but it returns null.
button.get("offset") # Returns null
What’s the problem?
null if the property doesn’t exist on the node or the property itself is
What kind of node is
button? Are you setting the
offset property or is the node determining it?
timothybrentwood | 2021-05-17 19:46
Oh, so apparently I was writing the script in the node named “button”. I tried using “self” instead which this returning the expected value instead of null.
Multirious | 2021-05-18 15:02
get() is more used for times when you don’t necessarily know what kind of node you’re working with so you don’t cause crashes by accessing a property that doesn’t exist. If you know what node you’re working with your should either access the property itself using
node.property or if it is the node that the script is attached to:
self.property (which calls the getter/setter).
timothybrentwood | 2021-05-18 15:27