Reference a static variable from an instance

Hello, fairly new to Unity and C#, I have a Character script I’m using to make instances of characters, and a PlayerStats script storing static variables, trying to give each instance it’s own variable they can modify in PlayerStats by either referencing it in Unity or possibly by using an ID number (e.g. char1 - var1, char2 - var2, etc.), thought about just storing this variable in the Character script, but trying to use these variables as a currency might become troublesome if too many characters are added, anyway of doing something like this? Or am I going about this completely wrong? Couldn’t really find anything like this scenario online, so help would be much appreciated.

Thanks for reading :slight_smile:

If the PlayerStats script is also on the same object as the character script you can do:

public class Character : MonoBehaviour
    public PlayerStats PlayerStats { get; private set; }

    private void Start
        PlayerStats = GetComponent<PlayerStats>();

public class PlayerStats : MonoBehaviour
    public int Health;
    public int Shield;

Spent sometime searching how to use lists and made a super simple system that does what I want that I’m very happy with

        public List<float> matValueList = new List<float>();
        public float Material0;
        public float Material1;
        public float Material2;
        void Start()

Make a list in your playerStats

public PlayerStats playerStats;
public int Id = 0;

public void Increase();
   playerStats.matValueList[Id] += 1

Then all you gotta do is get some kind of reference to it, and give an iD, now the Character with ID 0 increases Material0. This is probably pretty trivial to more experienced programmers. But this newbie is proud to of figured it out, hopefully this helps anyone with the same issue I was in :slight_smile: