So, I'm pretty new at C#. Teaching myself and using tutorials when I can. Currently I am working on an inventory system. I have a scriptable object to store all my pieces of armor by sets. I'm using iFrames to do this. What I need to be able to do is when I set my default armor for different classes to just be able to scroll through a list of armor (I've made the list in my armor script) on the inspector on my PlayerClass Scriptable Object.
Below is the code for my Armor Collection
public class ArmorCollection : ScriptableObject
{
[System.Serializable]
private class ArmorSet
{
public string armorSetName;
//gear sprites and stats are below this in this nested class
}
[SerializeField] List<ArmorSet> armorSet;
private Dictionary<int, string> setName; //not sure if it should be a List or Dictionary currently
[HideInInspector] public Dictionary<int, string> SetName { get => setName; }
private void OnValidate()
{
for (int i = 0; i < armorSet.Count; i++)
{
setName.Add(i+1,armorSet[i].armorSetName);
}
}
And here is where I am stuck on my Player Class script:
public class PlayerClass : ScriptableObject
{
[SerializeField] PlayerStats playerData;
[SerializeField] PlayerGear gear;
[SerializeField] ArmorCollection armor;
[Space]
[SerializeField] string className;
[Header("Gear")]
[SerializeField] string startingArmorSet; //needs to be a dropdown list
So far, I thought about using enums, then realized that they are readonly. So that's out. I need to be able to change it based on the different scriptable objects: default class armor, common armor, uncommon armor, etc. Each one would have it's own set of different armor to pull from. I have been going between making the setName a list or a dictionary, but not sure how to make either a dropdown in my PlayerClass script.
Any help would be appreciated.