Author Topic: Weird Camera issues with NGUI in Unity 5.4  (Read 13596 times)

Meltdown

  • Jr. Member
  • **
  • Thank You
  • -Given: 10
  • -Receive: 0
  • Posts: 56
    • View Profile
Weird Camera issues with NGUI in Unity 5.4
« on: June 11, 2016, 08:00:11 PM »
EDIT : I've Isolated this problem is caused when a Scrollview with a grid is shown. So if I show another menu screen, and it has a scrollview with a grid, then go back to this screen, it has render problems.

I'm having a strange issue with the camera. I'm using NGUI 3.9.8.

I have a Truck Customise scene in my UI, where I have the UI camera set to Depth Only, with depth set to 1.
And a second camera for rendering my truck's garage scene, set to Depth Only, with depth set to 0.

This is what it looks like...



In some instances, when I load one of the other screens, in this case the 'Buy Crates' screen.
Which looks like this...



Yet when I go back to the Truck Customise screen, it shows mostly black where the scene camera is rendering


In addition, if I see this blackness on the screen, then in the editor enable a UI element/gameobject that draws over this black, it appears over the blackness, but if I disable the gameobject again, it stays on the screen!

Is there something I'm doing wrong or should I log a bug with Unity about this?
« Last Edit: June 11, 2016, 08:11:28 PM by Meltdown »

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Weird Camera issues with NGUI in Unity 5.4
« Reply #1 on: June 12, 2016, 03:10:34 AM »
You said yourself you have 2 cameras both clearing depth. What about color? You need to have the first camera to render actually clear the color too.

Meltdown

  • Jr. Member
  • **
  • Thank You
  • -Given: 10
  • -Receive: 0
  • Posts: 56
    • View Profile
Re: Weird Camera issues with NGUI in Unity 5.4
« Reply #2 on: June 12, 2016, 03:11:13 PM »
You said yourself you have 2 cameras both clearing depth. What about color? You need to have the first camera to render actually clear the color too.

It doesn't matter which configuration I have my camera's clear flags to, I still get the same problem.

I have my UI camera set to Depth Only, and my scene camera set to Solid Color, same problem.
I try my UI camera set to Solid Color, and my scene camera set to Depth only, then the scene is then just set to the solid color.

My UI camera culling is set to UI
My scene camera culling is set to UpgradeGarage (which is the 3D scene of the garage)

Why would showing/hiding another panel with a scrollview only cause this problem?
Is there something else I can check?
« Last Edit: June 12, 2016, 04:21:07 PM by Meltdown »

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Weird Camera issues with NGUI in Unity 5.4
« Reply #3 on: June 13, 2016, 01:33:37 AM »
I see no reason why showing a UI panel would make your game camera's render get disabled. What does the scene view show?

Meltdown

  • Jr. Member
  • **
  • Thank You
  • -Given: 10
  • -Receive: 0
  • Posts: 56
    • View Profile
Re: Weird Camera issues with NGUI in Unity 5.4
« Reply #4 on: June 13, 2016, 01:37:25 AM »
The scene view is supposed to show what is in the 1st picture I posted, instead, it shows what is posted in the 3rd picture.


ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Weird Camera issues with NGUI in Unity 5.4
« Reply #5 on: June 13, 2016, 01:39:30 AM »
I thought that was game view? Tilt the camera in the scene view, show where the black stuff is coming from.

Meltdown

  • Jr. Member
  • **
  • Thank You
  • -Given: 10
  • -Receive: 0
  • Posts: 56
    • View Profile
Re: Weird Camera issues with NGUI in Unity 5.4
« Reply #6 on: June 13, 2016, 01:51:54 AM »
Ok, I see what happened now...

I had my UpgradeGarageScene gameobject underneath my UI-UpgradeGarage heirarchy (which is the root for my UI screen for the garage).
UpgradeGarageScene and all its children are in the UpgradeGarage layer.

For some reason, showing other panels and screens does nothing, but when closing a panel with a scrollview/grid, it updates the UpgradeGarageScene and all its root children to now be on the UI layer.

I fixed this by moving UpgradeGarageScene out of my UI heirarchy, and it works perfectly fine now.

Thanks for the help :)