0 votes

I'm trying to use get() on a vector path but it returns null.

button.get("offset") # Returns null

What's the problem?

Godot version 3.3
in Engine by (80 points)
edited by

get() returns null if the property doesn't exist on the node or the property itself is null.
What kind of node is button? Are you setting the offset property or is the node determining it?

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.

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: property or self.property (which calls the getter/setter).

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.