Question About Arrays c#

hey guys im working on a rpg project and i want to add character stats like damage , defence , stamina ,strength
would it be good to make it with arrays or default variables?

Why not make a class with the necessary stats and let each player (I suppose you have a player script to handle damage and combat etc.) have a single instant of the stat class?

you mean to make a new script ? thats what i did in a past script that i made i just wanted to ask because i saw another one making it different than i did he was making it with arrays…

depends on your needs, if all your stats will be of the same type, will have “the same function” and you want to loop through them easily, sure you can go with an array. Be sure the make a “player” script and store all your values related to your player there. Having all variables scattered around everywhere is never a good thing, keep them as local as possible

go on youtube and search for burgzergarcade, he has some video-tutorials on how to make those kinds of things, he uses setters and getters to make those class specific attributes public, and you can always derive from that base class your Main Player your Enemy players, your npc’s and so on…

Give it a try, it’s a good starting point :slight_smile: