Is it possible to use 2d animations in UI under canvas?


I sorted it out.

Add a new Game Object under Canvas, then add and image to it under UI, Open Animation window and animate as normal.

So to answer my own question, yes we can. :slight_smile:

I was told once that what was needed was to make a texture array and cycle through it.

Hereโ€™s a class that should do what you want, just provide it an array of textures:

using UnityEngine;
using UnityEngine.UI;
using System.Collections.Generic;

public class TextureCycler : Graphic //MaskableGraphic if you want it to work with masks
	public Texture[] gifPicArray; 

	private int counter = 0;
	void Update()
		renderer.material.mainTexture = gifPicArray[counter++];
	if(counter >= gifPicArray.Length)
		counter = 0; //ninja edit