- Home /
Load all sprites from an object I already have an instance of
I know that you can use Resource.LoadAll() to get a Sprite array from a Sprite sheet (Sprite's type set to Multiple). But say I already have an instance of the Sprite sheet object, is there a way I can get a Sprite[] from it?
Answer by FortisVenaliter · May 12, 2016 at 10:36 PM
How do you have an instance of a sprite sheet? I don't know of any public classes that would allow that reference.
That being said, if you did somehow get a reference, you might be able to pull them with GameObject's function GetComponentsInChildren().
public Object spriteSheet;
The reference I have to the spritesheet is just an Object, basically like above. The way I get it is putting it into an array in the Editor.
Well, Object is literally the very base class... it has almost no functionality of it's own, so it's not very useful. I don't think this is the right way to go about it. You need to either make an array of sprites and put them in there from the sprite sheet manually, or do the resources load method.
Your answer
Follow this Question
Related Questions
Multiple Cars not working 1 Answer
Distribute terrain in zones 3 Answers
Sprite Fade In/Out Not Working 1 Answer
Character Sprite "Spasms" 0 Answers