Search Unity

How to prevent single frame render on boot?

Discussion in 'General Graphics' started by plolley, Jul 15, 2015.

  1. plolley

    plolley

    Joined:
    Dec 19, 2014
    Posts:
    7
    I'm having an issue where my game renders a single frame between the Unity boot splash screen and my intro screen. I can't seem to figure out how to prevent it. Is there a way to disable all rendering until I'm ready? I've tried putting a full black image in my hierarchy but it doesn't seem to help.

    Thanks!

    Unity 5.0.1 & Android
     
  2. Gambit-MSplitz

    Gambit-MSplitz

    Joined:
    May 16, 2015
    Posts:
    1,247
    The main things that cause rendering to your screen in unity is Cameras and Canvases. Disabling all of them will prevent anything from rendering, though if you aren't rendering anything for a frame, your previous frame remains on-screen. If you want a quick and easy solution, you can make a camera with a culling mask that makes it see nothing, then set it clear using a solid color and put the camera on the highest layer. That will force it to clear the screen to that color, even with other cameras active. Then simply destroy that camera when you're done.

    Though I must say, needing the first frame not to render is quite a unique and overly complicated problem for what you get out of it.
     
    theANMATOR2b likes this.
  3. plolley

    plolley

    Joined:
    Dec 19, 2014
    Posts:
    7
    I tried setting the culling mask to nothing and clear to black in the inspector and then setting them both to proper values on init but I'm still getting a flash of rendering.

    The odd thing is that if I create a fullscreen blackout UI element there's no flash. As soon as I disable the element in code I get a brief flash before my other blackout covers the screen. It seems like there's some kind of weird render order going on. I'm still investigating.
     
  4. plolley

    plolley

    Joined:
    Dec 19, 2014
    Posts:
    7
    I've "fixed" this by adding a delay before removing the blackout UI element. No idea why the initialization is so sensitive..
     
unityunity