I think I wasn’t the only one who did it this way. It seems to be easier and faster. Here is my code:
public float fadeTime = 5f;
void Start () {
GetComponent<Image>().CrossFadeAlpha(0f, fadeTime, false);
Invoke ("SetAsInactive", fadeTime);
}
void SetAsInactive(){
gameObject.SetActive(false);
}