using System.Collections; using System.Collections.Generic; using UnityEngine; public class modeltexanim : MonoBehaviour { public Texture[] frames_tex = new Texture[3]; public float frames_dur = 0.06f; //1フレの表示時間 float frames_time = 0; int frames_num = 0; Renderer rdr; void Start () { rdr = GetComponent(); } void Update () { frames_time -= Time.deltaTime; if (frames_time < 0) //時間ごとに動く { frames_time = frames_dur; frames_num++; //フレーム番号+ Tekusuture_sasikae(); } } void Tekusuture_sasikae() { //入ってなかったら返す if (rdr == null) return; if (frames_tex[0]==null)return; if (frames_num >= frames_tex.Length)frames_num = 0; //ループ rdr.material.SetTexture("_MainTex", frames_tex[frames_num]); } }