Bachalo
Bachalo

Reputation: 7219

How to fade alpha on GameObject using Standard Shader?

How to simply fade a game object that has a Standard shader applied?

This is my code. If I switch the shader to Sprites.default it works.

public void foo(float val)
{
     _isFade=true;
     float time=2.0f;
     float alphaVal=0.0f;
     LeanTween.alpha(gameObject, alphaVal, time);

     Debug.Log("YES calling fade in foo !!!! and gameObject = "+gameObject);
}

Upvotes: 0

Views: 2245

Answers (1)

EvilTak
EvilTak

Reputation: 7579

Make sure that you have the type of the Standard shader set as "Fade" or "Transparent" on your material.

Upvotes: 1

Related Questions