Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

Question Make entire screen flash with free aspect ration

Discussion in 'Editor & General Support' started by JimTamales, Jan 15, 2023.

  1. JimTamales

    JimTamales

    Joined:
    Mar 6, 2022
    Posts:
    5
    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?
     
  2. spiney199

    spiney199

    Joined:
    Feb 11, 2021
    Posts:
    6,016
    JimTamales likes this.
  3. karliss_coldwild

    karliss_coldwild

    Joined:
    Oct 1, 2020
    Posts:
    530
    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.
     
    JimTamales and spiney199 like this.
  4. JimTamales

    JimTamales

    Joined:
    Mar 6, 2022
    Posts:
    5
    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.