- Home /
Question by
Arch4ngel · May 18, 2020 at 08:47 AM ·
c#runtimeuniversalanti-aliasing
How To Enable Or Disable URP Camera SMAA At Runtime With C#
I want to enable or disable SMAA at runtime with c#? I can't find the appropriate code to do this
screen-shot-2020-05-17-at-42308-pm.png
(32.9 kB)
Comment
Answer by cassius · Jun 01, 2021 at 01:49 AM
This post is over a year old, but showed up first for me on searches. Hopefully this will help someone.
Here's how I did it, making sure first that my Camera GameObject has the UniversalAdditionalCameraData script added.
using UnityEngine.Rendering.Universal;
.....
Camera cam = GetComponent<Camera>();
UniversalAdditionalCameraData uacm = cam.GetComponent<UniversalAdditionalCameraData>();
uacm.antialiasing = AntialiasingMode.SubpixelMorphologicalAntiAliasing;
uacm.antialiasingQuality = AntialiasingQuality.High;