GetComponent for Pixel Perfect Camera

I’m not sure if it’s something I’m doing wrong but I cannot find a way to get the Pixel Perfect Camera component from the main camera. I want to change values there but I’m struggling to even access it. Wasn’t sure if this was on purpose or if it’s a bug.

GetComponent<PixelPerfectCamera> does not work.

If this were a bug in Unity then absolutely nothing would work.

“Does not work”. Maybe ellaborate because nobody knows what that really means. If you’re hinting that its returning NULL then it simply means that this component isn’t on the GameObject you’re calling “GetComponent” on; it’s as simple as that.

@MelvMay the most unhelpful response I’ve ever read on here to date, and that is quite the achievement. Congrats!

Had the same issue. For me it was my imports. I was using: using UnityEngine.U2D; which is not the “right” PixelPerfectCamera for some reason. If you instead do using UnityEngine.Experimental.Rendering.Universal; it will work

We get thousands of posts stating “it does not work” where devs do not explain what is actually wrong and other devs spend a lot of time guessing what is wrong before being able to suggest a fix. Please spend thousands of hours helping people on the forums, then come back and tell me about being helpful. :wink:

You could’ve easily posted your suggestion without such exaggerated criticism too.

3 Likes

For anyone who encounters this issue after upgrading to unity 6 (I’m on 6000.0.19f) you need to use the import using UnityEngine.Rendering.Universal; rather than the experimental version in order to get a reference to a pixel perfect camera.

I don’t know why this wasn’t addressed somewhere more obvious, but glancing through the docs for unity 6, i found no mention of the change and haven’t seen anyone else post an information about this. maybe I’m just blind though.

1 Like

replying to a real unity staff member like this is INSANE to me lmfao

people get toxic when getting help for free; exactly my humour.
I stopped helping people bc every second answer of mine was either ignored or I got a toxic response. Most questions are too low effort, no explanation what went wrong, what they have tried to fix it, no hello, thank you etc.
Most people here are some arrogant coder kids bc every serious Pro has Unity Pro and gets help on other channels.

Isn’t it more fun to help someone who you know is doing it as a project, or just for fun? If youve got enough money for a license I expect you probably know enough about game dev to barely ever need to use one of these forums.

1 Like

no fun, bc like I said; the default is that they don’t value your know-how and effort you put in, for free.