Godot Version
4.3
Question
`
Hey everyone ,
I am currently trying to create a supermarket shelf, which contains a specific item.
E.g. Apple, Bread and so so on.
For that I created resources for each of the items.
To randomly select one of those resources to spawn on my shelf, I created another resource that holds an array with all of my item resources.
To test if I can fetch the contents of my Itemlist
resource, I tried to print out them out.
This results in following output: Resource#-9223372007209433817
Below you can find the scripts for my resources aswell as the script for the shelf in which I am trying to get their contents.
My question is, how would I store my Items so that I can dynamically expand them and call them in every script that I need them in?
I hope that someone can assist me in solving my issue.
In case you need more of the code or more insights, just let me know.
Thanks in advance
Items
resource:
extends Resource
class_name Items
@export var itemname: String
@export var itemprice: float
@export var itemquantity: int
@export_file("*.obj") var itemobject
Itemlist
resource:
extends Resource
class_name Itemlist
@export var itemlist: Array[Items] = []
Shelf script: (only the relevant snippet of the code)
class_name Interactable
extends StaticBody3D
@export var itemattributes : Itemlist
func _ready():
print(itemattributes.itemlist)
`