How do I send the data of an array to an instance?

Godot Version 4.3

How can I send the data of an array to an instance and let that instance alter the data?

I will be calling the array - the inventory
and the instances - dropped items.

I have it set up so that the player can drop items and this takes them out of the inventory. But I am struggling to be able to pick them back up. The player has a pickup range and each dropped item knows when it is in this range but I don’t know how to let the dropped items access the inventory.

Some ideas:

  1. The item sends a signal to the player when in range. The player is connected to that signal and, when emitted, updates the inventory array to perform the “pick up item” action.
  2. Make the inventory array a global variable, i.e. place it in an autoloaded script so that any node can read and modify it.
1 Like

This works thank you so much.

1 Like