about using sequence frame animations in unity

Source: Internet
Author: User

Tag:public   atime   als    not    http     Type conversion     how much     format    str   

 Animated array public object[] anim;    Limit how many frames a second public float fps = 30;    Frame sequence private int nowfram;    Record current time private float switchtime;    public string path = "Texture/33";    public bool Isloop = FALSE;    Public image Image;    public texture2d texture;    void Awake () {anim = Resources.loadall (path);        } void Update () {if (Anim = = null) {Anim = Resources.loadall (path);    } drawanimation (Anim);        } void Drawanimation (object[] tx) {switchtime + = Time.deltatime;            if (switchtime >= 1.0/fps) {nowfram++;            Switchtime = 0; if (Nowfram >= TX.                Length) {if (isloop) Nowfram = 0;            else return; }} if (Nowfram < TX.           Length) {texture = (texture2d) Tx[nowfram]; Sprite sp = sprite.create (texture, new Rect (0, 0, Texture.width, texture.height), New Vector2 (0.5f, 0.5f));        Image.sprite = SP; }    }

If the error occurs at run time, it is said that the type cannot be converted. Maybe you converted the picture type to a sprite. We're not going to get an error when we convert the tower to texture format in unity.

about using sequence frame animations in unity

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.