解决EnableKeyword(“_Emission“)运行状态不起作用

我使用的是Standard Shader,一开始"_Emission"没有开启

当我运行下面的代码,可以看到Inspector窗口已经生效,然而物体本身并没有重新开始渲染,反射没有开启

cs 复制代码
public GameObject go;
// Start is called before the first frame update
void Start()
{
    var m = go.GetComponent<MeshRenderer>().material;
    m.EnableKeyword("_Emission");
    m.SetColor("_EmissionColor", Color.red);
    m.globalIlluminationFlags = MaterialGlobalIlluminationFlags.RealtimeEmissive;
    go.GetComponent<MeshRenderer>().material = m;
}

解决方案: "_Emisson"参数保持开启状态,通过更改"_EmissionColor"来控制反射,_EmissionColor为纯黑时,效果等同于"_Emisson"参数关闭。

相关推荐
Artech3 小时前
[MAF预定义的AIContextProvider-03]ChatHistoryMemoryProvider——赋予Agent从经验中学习的能力
ai·c#·agent·memory·maf
Scout-leaf2 天前
C#摸鱼实录——IoC与DI案例详解
c#
咕白m6252 天前
使用 C# 在 Excel 中应用多种字体样式
后端·c#
Artech2 天前
[MAF预定义的AIContextProvider-02]AgentSkillsProvider——将Agent Skills引入MAF
ai·c#·agent·agent skills·maf
2601_962072553 天前
李梦娇常识4600问|题库|打印版
sql·华为od·华为·c#·华为云·.net·harmonyos
m0_547486663 天前
《C#语言程序设计与实践》 全套PPT课件
c语言·c#·c语言程序设计
叶帆3 天前
【YFIOs】用C#开发硬件之设备上云
开发语言·unity·c#
IT方大同3 天前
(嵌入式操作系统)信号量
嵌入式硬件·c#
探物 AI3 天前
【3D·感知】从PointNet到PointPillars:如何让自动驾驶汽车“实时“看见3D世界?
3d·自动驾驶·汽车
z落落3 天前
C# FileStream文件流读取文件
开发语言·c#