check alpha of gameObject C#

I have a button that fades into screen using leanTween, however I want to be able to only make the button click-able once it has finished fading it. I saw that the delay functions delay the whole scene so it will delay the fading as well.

I was thinking of using the update() function to check the alpha of the button till it is maxed (or == 1f) but cant find out how to do this, any help please?

Thanks in advance.

renderer.material.color.a - for gameobjects

GUI.color.a - for GUI elements

and… taadaaaaa! LeanTween.alpha for leanTween

If you are using a new UI button, you could find the targetGraphic and use the built in crossfade. Or do it manually. Based on your comment code it looks like you are use the UI.Button, in which case it usually has a reference to a Graphic.

UnityEngine.UI.Button b = new UnityEngine.UI.Button();
b.targetGraphic.CrossFadeAlpha(0, .6f, true);

// or check/set alpha/color directly
b.targetGraphic.color.a = 0;

I’ve never used LeanTween, but looking at the documentation it has a LeanTween.isTweening method that looks like it would return false once the tween has finished.

Try checking if the tween is still tweening instead of checking the alpha, it makes more sense if you think about it, you just want to know if it finished, and with this method you can change the final alpha value if you need to and everything should still work.