unitytips: Sprites Collection

Sometimes we have related sprites that can be used in a prefab, like sprites for the environment, props, and scenario. Would be cool if we can easily swap them directly on the prefab without need to find and set the sprite directly in the SpriteRenderer component?

SpritesCollection component

I created this SpritesCollection component that allows us to define a collection of sprites to a prefab/GameObject and then easily swap between the sprites available.

Source code

I strongly recommend that you use the Gist Importer to import this gist to your project, but if want to import it manually, just access the gist and add all .cs files to any folder on your Unity project, except the SpritesCollectionEditor.cs, this one should be added to an Editor folder.

Loading comments...