error CS0266: Cannot implicitly convert type INGUIAtlas' to
UIAtlas'. An explicit conversion exists (are you missing a cast?)
В начале была ошибка с NGUI, но после обновления NGUI другая ошибка исчезла, но эта осталась! Искал как решить, но так и не нащел.
Возникает вот в этой части.
private UIAtlas startatlas;
{
m_sprite = this.GetComponent<UISprite>();
startatlas = m_sprite.atlas;
spritenames = startatlas.GetListOfSprites();
m_trans = this.transform;
}
Вот скрипт полностью!
using UnityEngine;
using System.Collections;
public enum AnimType
{
Once,
Loop
}
public enum Dir
{
Up=0,
Right=90,
Down=180,
Left=270
}
public class StartLogAnim : MonoBehaviour {
private UIAtlas startatlas;
public AnimType type;
public float Delaytime;
public int FrameRate;
private float timeperframe;
public int startindex;
public int endindex;
private int FrameNum;
private int currentframe;
private UISprite m_sprite;
private BetterList<string> spritenames;
public bool NeedRotate;
public bool NeedSnap;
public bool NeedTranslate;
public Dir targettdir;
public Dir[] currentdir;
private Transform m_trans;
public Vector3[] TranPos;
void Awake()
{
m_sprite = this.GetComponent<UISprite>();
startatlas = m_sprite.atlas;
spritenames = startatlas.GetListOfSprites();
m_trans = this.transform;
}
void Start()
{
currentframe = 0;
FrameNum = endindex - startindex;
timeperframe = 1f / FrameRate;
StartCoroutine("StartAnim");
}
IEnumerator StartAnim()
{
yield return new WaitForSeconds(Delaytime);
if (type == AnimType.Once)
{
do
{
yield return new WaitForSeconds(timeperframe);
currentframe++;
m_sprite.spriteName = spritenames[currentframe+startindex];
if (NeedSnap)
{
UISpriteData temp = startatlas.GetSprite(m_sprite.spriteName);
m_sprite.width = temp.width;
m_sprite.height = temp.height;
}
if (NeedRotate)
{
m_trans.rotation = Quaternion.Euler(Vector3.forward * (int)(currentdir[currentframe] - targettdir));
}
if (NeedTranslate)
{
m_trans.localPosition = TranPos[currentframe];
}
}
while (currentframe < FrameNum);
}
else
{
do
{
yield return new WaitForSeconds(timeperframe);
currentframe++;
if (currentframe == FrameNum)
currentframe = 0;
m_sprite.spriteName = spritenames[currentframe+startindex];
if (NeedSnap)
{
UISpriteData temp = startatlas.GetSprite(m_sprite.spriteName);
m_sprite.width = temp.width;
m_sprite.height = temp.height;
}
if (NeedRotate)
{
m_trans.rotation = Quaternion.Euler(Vector3.forward * (int)(currentdir[currentframe] - targettdir));
}
if (NeedTranslate)
{
m_trans.localPosition = TranPos[currentframe];
}
}
while (true);
}
}
void EndAnim()
{
StopCoroutine("StartAnim");
}
}