Attempt to call function 'add_point' in base 'null instance' on a null instance

pls help me

Pardon me for asking but what are you trying to do?

Is GameManager a line2d? Polygon? What kind of node is GameManager?

It can’t get the node 'GameManager`.

Some possible reasons:

  • It’s not exists.
  • Your spell is wrong.
  • It exists in its parent’s child, not its child.

By the way, if you want to make a global node, use singleton (Project Settings → Auto Load)

gamemanager is a node2d that has a script which control the collectable

how do i get from another parent and not its child?

I think you can make it as a singleton(Project Manager → Auto Load), or store it in a variable of a singleton. The third way is get_tree().root.get_child("MainNodeName/path/to/child").

instead of getting the node, can just by sending signal to trigger the add_point function

hey can you explain to me how can i activate a script by signal please i dont fully understand signals

Signal just means a array stored functions it will call.

how can i fix my problem pls help me i am desperate

Make GameManager as a singleton.
Then use GameManager instead of %GameManager, remove that var game_manager

thank you

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.