- Edited
Hey all! Unity refugee here, trying to learn Godot and its going well! The majority of what I knew in Unity translates pretty well into Godot, just have to learn the new syntaxes and all. In the case of this post, I've got some questions about arrays.
I'm working to build out a simple inventory system, the key piece is an array that holds all the items. Right now I just have it as an array of strings that are the names of the items in specific slots. But I want to get something closer to what I had in Unity, so I'm trying to figure out how to make an array of Item, rather than an array of Strings.
In Unity I would simply make a scriptable object called Item, then in my inventory script I would have a list (array) of items.
List<Item> items = new List<Item>();
In Godot I'm not exactly sure how I would replace these values. I can make an array pretty easily:
var items = [ITEM]
But now I'm trying to add an Item to it. Looking around it seems that you can create a Resource that works about the same as the Unity Scriptable Objects, from what I can understand at least. But I can't figure how to add a Resource to a list. Is this even a good way to do this? I'm trying to find tutorials online for inventories, but I'm not finding any that use a system like what I need, or they are out of date. Any help here?
1.) Shouldn't I be making a Resource for every item in my game?
2.) Can I make an array of Resources? How?
Any help here would be great! Thanks!