Cyanilux / URP_BlitRenderFeature

Blit Render Feature for Universal RP's Forward Renderer. Set specific source/destination via camera source, ID string or RenderTexture asset. Also options for _InverseView matrix and _CameraNormalsTexture generation.
MIT License
587 stars 74 forks source link

Changing Blit material in run time #5

Closed gsm041039 closed 3 years ago

gsm041039 commented 3 years ago

Hi, this feature is working fine on my project :)

but I want to ask if there have a way to change blit material in run time through script? I am not familiar with scriptable render pipeline and I can't find any useful information about it.

It will be a big thanks if you can tell me about it!

Cyanilux commented 3 years ago

You can obtain a reference to the Blit feature by using a global field that you can set in the inspector.

public class Example : MonoBehaviour {

    public Blit blit;
    public Material newMaterial;

    public void Start() {
        blit.SetActive(true);
        blit.settings.blitMaterial = newMaterial;
    }
}