0 votes

There is a problem in my script that does let me change monitorable of key at first if but not letting me in elif. Ground is working properly and I know this can be the least polished way of doing it but I don't have time to make it more polished so if it works I don't care.

Here is the error : Attempt to call function 'set_monitorable' in base 'null instance' on a null instance.

Note : Key is an Area2D

var active = false

func _process(delta):

if active == false:

$Ground.scale = Vector2(0.05, 0.05)

elif active == true:

$Ground.scale = Vector2(1, 1)

I'm changing active var in another script

Also I don't care if solution has monitoring if it is workin. Also I already tried disableing collision shape but same problem

Godot version 3.2
in Engine by (70 points)
edited by

1 Answer

+1 vote

Attempt to call function 'set_monitorable' in base 'null instance'means that _process(delta): was called $Key didn't resolve to a valid value - like Godot wasn't able to find a child node of the node that script is attached to named Key.

  1. Did you change the node path of the Key node in your scene tree and forget to change it in code?
  2. Are you calling queue_free() on Key anywhere in your code?
  3. Are you re-parenting Key at any point in your code?
by (3,870 points)
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.