Reputation: 21
I would like to know how to get started about making a sprite (or any other complexe types) serializable ?
Is each case specific or is there a general approach ?
EDIT:
Let me reiterate my question, I can figure out how to code gamelogic, I've been programming for a couple of months only, but this, this is my first "big" problem that I don't even see where to start looking.
So I'd like to know what it takes to achieve this, what to look for. A starting point.
Upvotes: 1
Views: 3607
Reputation: 4888
I don't quite get what you're trying to do, but if you need a reference to a specific sprite you can do either of these:
1 - Load sprite by name from the Resources folder.
Sprite sprite = Resources.Load<Sprite>("Items/Sword");
2 - Use the [SerializeField] attribute to serialize all your sprites.
[SerializeField]
Sprite sprite;
Upvotes: 3