Game stats storage / display I have a simple game where you try to go as high up with rockets as possible. I currently store 2 statistics about your playthrough:


Current altitude 
Highest altitude


These statistics are stored in a Dictionary&lt;string,float&gt; where the string key is the name of the statistic. I have two tasks related to stats, setting the statistic, which I do as follows:

public class UpdateAltitude : View
{
    public float AltitudeFactor
    {
        get
        {
            return altitudeFactor;
        }
        set
        {
            altitudeFactor = value;
        }
    }

    [Inject]
    public IDictionary&lt;string, float&gt; Stats
    {
        get;
        set;
    }

    [SerializeField]
    private float altitudeFactor;

    // Update is called once per frame
    private void Update()
    {
        var altitude = AltitudeFactor * transform.position.y;
        Stats["altitude"] = altitude;
        Stats["maxaltitude"] = Mathf.Max(Stats["maxaltitude"], altitude);
    }
}


View here is a baseclass from the StrangeIOC framework that allows me to inject into Unity behaviours. The SerializeField attribute allows me to display the private field in the editor for an artist to use (Unity cannot display properties, so this is a common workaround).

The Stats dictionary is created and injected into my View instances from a StrangeIOC context like so:

var stats = new Dictionary&lt;string, float&gt;()
    {
        {"altitude", 0f},
        {"maxaltitude", 0f}
    };

injectionBinder.Bind&lt;IDictionary&lt;string, float&gt;&gt;().ToValue(stats).ToSingleton();


The other task, displaying the statistic, is done thusly:

public class StatLabel : View
{

    public string FormatString
    {
        get
        {
            return formatString;
        }
        set
        {
            formatString = value;
        }
    }

    [Inject]
    public IDictionary&lt;string, float&gt; Stats
    {
        get;
        set;
    }

    [SerializeField]
    private string statName;

    public string StatName
    {
        get
        {
            return statName;
        }
        set
        {
            statName = value;
        }
    }


    [SerializeField]
    private string formatString;

    private UILabel label;

    protected override void Start()
    {
        base.Start();
        label = GetComponent&lt;UILabel&gt;();
    }

    private void Update()
    {
        label.text = string.Format(FormatString, Stats[StatName]);
    }
}


Here a UILabel is essentially a TextBlock control from the NGUI framework.

My issue is that in order for an artist to work with this within the Unity Framework, they need knowledge of the exact string keys in this dictionary, an enum would be a preferable solution, because they appear in the Unity editor as a combo box of possible options, however this would couple my StatLabel class to this game's enum, and each new game would require a custom version.

I intend soon to add additional statistics, such as speed, max speed, coins, etc, so would like to know if I can improve the existing code to make it more artist-friendly, and reusable, while keeping it extensible.
I assume by artist you mean graphic or sound effect designers. The logic should independent from its visualisation. How data like altitude is stored or processed is no concern for the artist. To stay in Unity3D, you should create components (or complete prefabs) that render graphics or play sound effects. Having a enum for the dropdown is the preferred way as you mentioned. You map it to the corresponding names in the component for the artits. The component is easy to reuse. In your case extracting UILabel and 'TextBlock' is key. Consider those to styled by artists. You then create copies of the component for speed and coins or make it more generic for those cases.

tl;dr
Create components in Unity to separate logic and represantation (think or MVC controller and view) in components. Design view components artist friendly and controller components coder friendly.