Make entire screen flash with free aspect ration

Much like in the video below I am trying to find a way to make the entire screen flash a certain color.

I’ve been using a Image object, resized it to cover the camera and altered it’s alpha to achieve this effect.

The problem is I am making a 2D, free aspect ratio game and because of that there are instances where the image flash won’t cover the entire screen. The solutions to this would probably be to alter the image size according to the situation. But I was wondering if there is any way to simply progressively turn the entire camera view to a certain color preferably doing so from code? Or maybe there are other more elegant solutions to this?

I think this is a pretty simple use-case for a Canvas-scaler: Canvas Scaler | Unity UI | 1.0.0

Should make it easy to keep your full-screen image always remain full-screen.

1 Like

I don’t think canvas scaler matters in this case. Screen space overlay canvas should cover the whole screen regardless of canvas scaler settings. And once you have a canvas covering whole screen, you can anchor an image so that it gets stretched to cover whole canvas. Canvas scaler would be more important if you tried to use less trivial image(some kind of vignette effect or something similar) which needs to be stretched in more controlled manner. But for single color rect anchored to all 4 corners there shouldn’t be a difference.

2 Likes

Thank you for your replies. I am using World Space render mode and changing that breaks all my UI stuff so that’s a no go. I ended up making the canvas way bigger than the camera and stretched the image to it’s exact size. It’s not as “infinite” as I would like but it does the job.