![]() |
Attention | Topic was automatically imported from the old Question2Answer platform. |
![]() |
Asked By | Floppy |
In my inventory system, I have a toolbelt and an inventory seperately. They work pretty much the same, except for a few minor changes. I decided to add them both in the same script for convenience.
So right now, I have this code:
export var inventory = Array() setget set_inventory, get_inventory
export var toolbelt = Array() setget set_toolbelt, get_toolbelt
func _init():
inventory.resize(18)
print(inventory.size())
toolbelt.resize(6)
print(inventory.size())
This will first output the following below.
18
6
Which of course is incorrect, as both log the same thing. If I remove the export
in front of both variables, it does work. But from my testing, the method ResourceSaver.save
, which I use to save the inventory, only seems to save exported members.
How can I fix this issue?
You haven’t shown your setters and getters. Is it possible you copy and pasted and forgot to change the member variable they use?
Bernard Cloutier | 2020-10-19 15:13