I have a image sequence array made of .pngs that plays at the opening of a scene. After that image sequence stops I would like to load a new level only I’m having trouble doing that. I would like to know how I can modify my code to make that possible. Seems easy but i just can’t get it right here is the code I’m working with.
using UnityEngine;
using System.Collections;
public class ImageSequenceTextureArray : MonoBehaviour
{
private Object[] objects;
private Texture[] textures;
private Material goMaterial;
private int frameCounter = 0;
void Awake()
{
//Get a reference to the Material of the game object this script is attached to
this.goMaterial = this.renderer.material;
}
void Start ()
{
this.objects = Resources.LoadAll("Sequence", typeof(Texture));
this.textures = new Texture[objects.Length];
for(int i=0; i<objects.Length;i++)
{
this.textures _= (Texture)this.objects*;*_
* }*
* }*
* void Update ()*
* {*
StartCoroutine(“Play”,0.60f);
* goMaterial.mainTexture = textures[frameCounter];*
* }*
* IEnumerator PlayLoop(float delay)*
* {*
* yield return new WaitForSeconds(delay);*
* frameCounter = (++frameCounter)%textures.Length;*
* StopCoroutine(“Play”);*
* }*
IEnumerator Play(float delay)
{
yield return new WaitForSeconds(delay);
* if(frameCounter < textures.Length-1)*
* {*
* ++frameCounter;*
* }*
StopCoroutine(“Play”);
* }*
}