Hello I am new to unity, so I am sorry if the solution is incredibly simple but whenever I try to start a coroutine in unity is does not call on my IEnumerator fillTimer(), I am not quite sure what to do to so I am posting here. As for some background context I am trying to fill an image every 0.01 second, to give it a smooth increase, almost like an animation. Here is my code:`using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class OfferCreationSystem : MonoBehaviour
{
public GameObject offer;
public Image successAnim;
public float animGain = 0.001f;
// Start is called before the first frame update
void Start()
{
}
public void OnButtonPress()
{
StartCoroutine( fillTimer() );
//hide();
for (int i = 0; i < 10000; i++)
{
if(animGain != 100)
{
IEnumerator fillTimer()
{
yield return new WaitForSeconds(0.01f);
successAnim.fillAmount = animGain;
animGain += 0.001f;
}
}
}
}
public void hide()
{
offer.SetActive(false);
}
public void show()
{
offer.SetActive(true);
}
}
`
,