Search Unity

Setting a texture2d property on a material messes with the camera size. (pixel perfect)

Discussion in 'General Graphics' started by DoctorBronze, May 21, 2022.

  1. DoctorBronze

    DoctorBronze

    Joined:
    Oct 13, 2020
    Posts:
    13
    I am working on a pixelart FOV effect that works along with the pixel perfect camera as well as the universal render pipeline. And for some reason I have a weird glitch where the camera size becomes unstable, and switches to another value at random before going back to the original. On it's own it's not much of a problem and is unoticible in runtime, but when coupled with the fov effect it creates a weird rendering glitch which makes the game impossible to look at.
    I managed to track down the source of the instability to a single line in a script which sets the texture2d property of a material. Without that line or with the line commented out the camera seems to no longer become unstable, however the same line is crucial to the FOV effect script.
    One more thing I noticed is that it is unpredictable, with the glitch sometimes happening nonstop every single time I run the game, and sometimes not happening entire coding sessions.
    Anyone know why this is happening? (Been trying to fix it for weeks.)