c# - Unity - Changing Emissive Intensity not changing in game - Stack Overflow

Material mat = spriteRenderer.material;mat.EnableKeyword("_EMISSION");mat.globalIlluminationF

Material mat = spriteRenderer.material;
        
        mat.EnableKeyword("_EMISSION");
        mat.globalIlluminationFlags = MaterialGlobalIlluminationFlags.RealtimeEmissive;
        // Set Emission Intensity
        mat.SetFloat("_EmissiveIntensity", 10000); 

        // Apply Emission Color * Intensity to Force Update
        Color emissionColor = Color.white * 10000; // White for max glow
        mat.SetColor("_EmissionColor", emissionColor);

        spriteRenderer.material = mat;

I'm setting the material's emissive intensity and it kinda works but it doesn't show in game. When I succesfully change the intensity the sprites material turns to (Instance) where it shows the intensity as what I wanted but unless I manually change the float a bit it just doesn't affect in game. To change intensity; mat.SetFloat("_EmissiveIntensity", 10000); works but I've added other lines to make sure even though I still couldn't get it to work.

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744837957a4596379.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信