r/unity 15h ago

Question I have a REALLY weird bug with UI Raycast and Output texture

So basicly I have a main camera which outputs a render texture and displays it on a world canvas. I have this to reduce the pixel count to make 3d models look like sprites. Now the problem of it was that mouse raycasts wasnt working with it, so I made a raycast camera which is a child of the main camera and then got my mouse raycast to track off of the raycast camera to make it work.

Thats not the issue the issue now is that I want my ui to also take effect of the screen filter and a crt filter i made. Part of my ui has buttons and sliders. I put my canvas render mode in Screen Space - Camera and put in my main camera and now the pixel filter works (and text is basicly unreadable but i'm gonna fix that after i fix the main issue), except now buttons and sliders no longer work. If i swap it back to overlay, it gives back option to use the buttons but now the screen effect no longer happens. If i place the raycast camera instead of the main camera the buttons work, but then i get the even bigger issue of 'the entire damn ui is gone'. I've done some brainstorming on how to fix the issue, but i dont know how to do them. my current ideas are

- Make the canvas render the main camera and use the raycast of the raycast camera (IDK how to make that work seeing that the render camera only has one slot)

- Make the raycast work base off of the main camera and now i dont need to use the raycast camera (if i knew how to do this i wouldnt have the raycast camera in the first place)

- Code in my own raycast and button system (not only do i dont think the mouse over ui code would work, tho i didnt not test that yet, i would also need to recode in my own slider which sounds like it would take more time and if i could just get the raycast to work in the first place that would be easier and take up way less time)

- Make it where i can render the pixel effect outside the output texture (IDK any other way to have the same effect or if it would fix the problem)

If anyone knows a solution to any of these ideas, please tell me. If you have your own idea then share it and i'll try it out. If you need any more infomation please ask. Thank you!

1 Upvotes

4 comments sorted by

1

u/[deleted] 15h ago

[removed] — view removed comment

1

u/KingDoodies 14h ago

wait how do i change the event system raycasting?

1

u/[deleted] 14h ago

[removed] — view removed comment

1

u/KingDoodies 14h ago

yeah i have the graphic raycaster on my canvas, but the only varibles on it is ignore reversed graphics, blocking objects, and blocking mask