Skip to content

Instantly share code, notes, and snippets.

@rico345100
Created July 9, 2020 03:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rico345100/ab2936137d9ddd73c647f6ecff058989 to your computer and use it in GitHub Desktop.
Save rico345100/ab2936137d9ddd73c647f6ecff058989 to your computer and use it in GitHub Desktop.
Simple Unity C# Script for using generated Atlas from Unity Sprite Atlas.
using UnityEngine;
using UnityEngine.U2D;
public class AtlasSpriteLoader : MonoBehaviour {
[SerializeField] private SpriteAtlas m_Atlas;
[SerializeField] private string m_SpriteName;
void Start() {
GetComponent<SpriteRenderer>().sprite = m_Atlas.GetSprite(m_SpriteName);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment