Author Topic: [Solved] Corrupted rendering in Unity 4.1  (Read 5637 times)

damocles

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 18
    • View Profile
[Solved] Corrupted rendering in Unity 4.1
« on: March 21, 2013, 01:41:06 PM »
Hi, is this a known issue?


Whenever I start the game, some of the imagery gets corrupted (the right side is what the left side is supposed to look like).  Once I resize the screen, it fixes itself, but it happens around 90% of the time I start the game.

It's only happened since I moved to Unity 4.1.  I can't seem to fix it myself through changing settings and rendering types, so I figure Unity have changed something in the renderer that is making a mess.

Is this fixed in NGUI 3.5?  I ask because I have made some fairly substantial changes to the NGUI code in my project, and it's a pain having to go through and make the changes again.  So I want to be sure it'll fix the problem before I commit to it.

Or is there a simple fix I can do myself?
« Last Edit: March 22, 2013, 04:40:21 AM by damocles »

Tiles

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 35
    • View Profile
Re: Corrupted rendering in Unity 4.1
« Reply #1 on: March 21, 2013, 02:42:21 PM »
Did you have a look if the image layer is by chance the same than the background? That way the gui cannot decide which image to display in front. Just a thought :)

damocles

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 18
    • View Profile
Re: Corrupted rendering in Unity 4.1
« Reply #2 on: March 21, 2013, 02:46:27 PM »
Yeah I've already spent a few hours trying to fix it.  It's not a layer issue, and the image that's getting corrupted is on top due to a Z-position difference rather than widget depth or layering.  I even tried rebuilding the components form scratch, and changing them to use UITexture instead of UISprite.  Oddly though the corruption does seem limited to the left half of the screen - I've yet to see anything go screwy on the right side.  Although there is less NGUI content on that side, so that might be why.

Plus the system was working fine for ages in Unity 4.0.1, but as soon as I upgraded to 4.1, this started.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Corrupted rendering in Unity 4.1
« Reply #3 on: March 22, 2013, 02:04:15 AM »
4.1 has known issues with DirectX 11. Is that what you're using?

damocles

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 18
    • View Profile
Re: Corrupted rendering in Unity 4.1
« Reply #4 on: March 22, 2013, 03:16:59 AM »
Nope, DX9.

damocles

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 18
    • View Profile
Re: Corrupted rendering in Unity 4.1
« Reply #5 on: March 22, 2013, 04:39:52 AM »
Found the problem - somehow the UI camera had it's "depth clear" changed to "don't clear".  I don't remember turning it off - perhaps a third-party script did something.  It must have just been a coincidence that it got changed at the same time I upgraded to 4.1.  I guess the scene depth was messing with the camera depth buffer and resulting in the strange corruption.