Hi All.
I`m using Sprite Packer.
Sprite Packer doesnt work at Resoureces Folder. So We can
t use Resources.Load.
I want to assign (or load) sprite from Script.
How to do this?
Hi All.
I`m using Sprite Packer.
Sprite Packer doesnt work at Resoureces Folder. So We can
t use Resources.Load.
I want to assign (or load) sprite from Script.
How to do this?
using UnityEngine;
using UnityEngine.UI;
using System.Collections;
public class LoadSprite : MonoBehaviour {
private Image m_Image;
[SerializeField] private Sprite[] m_Sprites;
private int m_CurrentSpriteIndex = 0;
private void Start () {
m_Image = GetComponent <Image> ();
}
private void Update () {
m_CurrentSpriteIndex = m_CurrentSpriteIndex + 1;
if (m_CurrentSpriteIndex >= m_Sprites.Length) {
m_CurrentSpriteIndex = 0;
}
m_Image.sprite = m_Sprites [m_CurrentSpriteIndex];
}
}
Thank you for reply.
Now I do such like it.
But It`s not cool.
I want to know concept for Sprite Packer.