Are there any pros or cons storing all the stats like health, mana, stamina on the Game Instance than on the pawn?
Like preventing people from hacking and bugs in the future etc ?
The GameInstance class is an object that represents the instance of your game (if I understood the documentation correctly) To me, I wouldn’t place character stats in the GameInstance and would instead place it in a PlayerState (if you plan on making a multiplayer game) or in the class that represents your character.
As for security and cheating protection, a first step would be to validate the input coming from the client.
it would eliminate the step of having to save your health between levels, but thats a short sighted argument since it would create more script needed just to apply damage. personally i go with storing the variables in the character. though with multiplayer its a bit different since the values are stored on the server, im not a expert in multiplayer but if i remember right i think its just a replication issue and you have the players exist on both the client and server. since everything exists on the server that makes it the authority and the one that does all the change making, which in turn eliminates the hacks.
I will use different maps and i must store the health. It will be very PVP focused game and it would be bit OP if you could regenerate your Health by just going through a teleport… I’m about to slowly (over few years) revive my fav game that i was nolifing for a very long time :d
You can’t prevent the clients from changing their variables locally but you can prevent exposing internal server variables and validate input coming from the client before applying it on the server. You should use PlayerState if you want to keep a variable between levels.