Greetings, in my project I have an abstract class that doesn’t inherit MonoBehaviour. In this class I have 2-3 fields with their respective property getters/setters, similar to the one below:
[SerializeField()]
protected string _iconID;
public Sprite icon
{
get
{
return ItemDatabase.instance.FindIcon(_id, _iconID);
}
set
{
_iconID = value.name;
}
}
For memory’s sake, I am not storing the Sprite or GameObject itself in the field, but a string representing it’s name. Using that I call a method in my ItemDatabase that will return that object as needed. Now I’ve read about the coming changes and I’m trying the beta now, and my question would be:
Am I doing this correctly? Should I store the GameObject/Sprite/Texture itself instead of a string representing the name/ID in the Database? The project is still young and I can still do changes without screwing up everything. Thanks for your help