This code is not working. It continue adding also after 1.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class LoadingMain : MonoBehaviour {
public GameObject loader;
float num = 0;
bool trump = false;
void Update()
{
Debug.Log(Time.time);
Debug.Log("numero = " + num);
if (num == 0f)
{
Debug.Log("------>numero = 0");
loader.GetComponent<Image>().fillClockwise = true;
trump = false;
}
else if (num == 1f)
{
Debug.Log("------>numero = 1");
loader.GetComponent<Image>().fillClockwise = false;
trump = true;
}
if (trump) {
num -= 0.05f;
} else {
num += 0.05f;
}
loader.GetComponent<Image>().fillAmount = num;
}
}