0 votes

When I start the class "resource_queue.gd" following the example steps in the documentation it gives me errors when I try to use the method queue.queue_resource().

The error is caused in the part:

func queue_resource(path, p_in_front = false):
if path in pending:
elif ResourceLoader.has_cached(path):
    var res = ResourceLoader.load(path)
    pending[path] = res
    var res = ResourceLoader.load_interactive(path)

Exactly here: res.set_meta("path", path)

With the message:

Attempt to call function 'set_meta' in base 'null instance' on a null instance.

Could anyone help me with this situation? I assumed fully functional examples would come in the documentation. But since this does not work, I ask this question.

Godot version 3.3
in Engine by (15 points)

1 Answer

+1 vote
Best answer

"Attempt to call function 'set_meta' in base 'null instance' on a null instance" means that the variable res is null at the time of calling the set_meta() function on it. Which means ResourceLoader.load_interactive(path) returned nullbecause either you sent it a bad path or a resource doesn't exist at the path you sent it. Add:

func queue_resource(path, p_in_front = false):

Then run it again, when it crashes on you verify the last path does point to a resource.

by (3,711 points)
selected by
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 webmaster@godotengine.org with your username.