简体   繁体   English

如何使用标准着色器在GameObject上淡化alpha?

[英]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. 如果我将着色器切换到Sprites.default,则可以使用。

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);
}

确保在材质上将标准着色器的类型设置为“淡入”或“透明”。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM