agiro agiro - 1 month ago 9
C# Question

Variables on scripts

I have sprite sheet animations on prefabs, I made them using a script that has a Sprite[] array on them.
It is declared like

private Sprite[] spriteSheet;


I have like 20 prefabs in the scene. As I'm not using a static variable here, does that mean I have loaded 20 images for each and every one of them? If so, using a static one would solve this to have only 1 array?

Answer Source

Yes if its not static, you have 20 different arrays. I would suggest using singleton class instead of static.