最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

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

programmeradmin6浏览0评论
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.

发布评论

评论列表(0)

  1. 暂无评论