This might be a very confusing question, so i’ll try to explain it well.
I have a game, where right now i am making it so that i can deposit pickaxes, axes, fishing rods and all kinds of things to gather resources automatically. So, in the “DepositTool” script i need to actually set the amount of tools i want to be in a certain place, which is where i have the problem. As i have tons of different tools, i want them to be set automatically. (What i mean by that is that i otherwise would need tons of switch case statements which would be really annoying after making more tools).
I know i also could make it an array, but that becomes really confusing because i have to refer to them as indexes not the actual name of the tool
Is there a way to either have an array where i refer to the objects as their actual names or a way to reference only a single variable to change it.
Here is my code if that helps
public static ToolSlot pickaxe; public static ToolSlot axe; public static ToolSlot rod; public static ToolSlot net; public static ToolSlot pot; public static ToolSlot weapon;
The ToolSlot is just the tool and how many tools i have.
void Set(int num){
//PlayerStats.selectedtool.count = num;
}
That selectedTool is the thing i’m going for, which is why it’s commented out, because it does not exist.