Hello, I'm having more of a code-appearance issue than a logical problem itself. The thing is that i'm doing sort of a RTS/Tower defense building system.
As a base, I'm using an SO to store the common fields of every building or troop in the game
[Header("General Information")]
[SerializeField] protected Sprite _icon;
[SerializeField] protected string _name;
[TextArea][SerializeField] protected string _description;
public string Name => _name;
public string Description => _description;
public Sprite Icon => _icon;
From this class I'm defining some inheritance for every type of entity with some preexisting data, for example:
[CreateAssetMenu(menuName = "Towers/Tower Config")]
public class TowerConfig : Config
{
[SerializeField] private TowerStats _stats;
public TowerStats Stats => _stats;
}
For the tower, this is an example of the Monobehaviour driving the SO data:
public class Tower : MonoBehaviour
{
[Header("General Data")]
[SerializeField] private TowerConfig towerConfig;
[SerializeField] private Troop troopPrefab;
}
Some of the prefabs are buildings, so I also define another MonoBehaviour with the preset data to use in the Building System script: