Created
July 9, 2020 03:10
-
-
Save rico345100/ab2936137d9ddd73c647f6ecff058989 to your computer and use it in GitHub Desktop.
Simple Unity C# Script for using generated Atlas from Unity Sprite Atlas.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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