Question by
Ryanless · Apr 14, 2016 at 07:57 PM ·
gamesavingdynamic variables
applying and saving in UpgradeSystem
well for my Upgradesystem in my game in need a method like this:
public static void IncreaseStat<T>( T stat, float value, ShipStat player)
{
player.stat += value;
PlayerPrefs.SetFloat (stat.ToString (), player.stat);
}
or
public static void IncreaseStat( string stat, float value, ShipStat player)
{
// some way to covert the string stat into var Stat
player.Stat += value;
PlayerPrefs.SetFloat (stat , player.Stat);
}
where T is a variable of the class Shipstat, so for example hp is a variable of Shipstat. so then the method would increase player.hp by the given value.
But somehow i just cant find a way to make it work.
Comment
Your answer
Follow this Question
Related Questions
Collider disabling by itself... 2 Answers
Can I sell game for free with unity free version? 2 Answers
Post time at the end of the level 0 Answers
Help me Please!!!!!!!!!!! 0 Answers