Author Topic: Depth Pass causing game to crash  (Read 2524 times)

PhykenMedia

  • Guest
Depth Pass causing game to crash
« on: June 25, 2012, 09:06:28 AM »
We have noticed that when we have Depth Pass enabled on our GUI, the game crashes on our iOS devices (we have not tested them on Android devices). However, the game does not crash when played in Unity.

According to Xcode this is because of a null reference exception.  However, tracking this down has proven difficult due to the fact that the crash only occurs on devices.

This appears to occur immediately after the first-frame initialization of our own systems when Depth Pass is enabled in the editor prior to building out.  If Depth Pass is enabled later via code during the run of the program, it will immediately crash after it is activated.

Also, this is how we have our GUI setup (just in case we did something wrong):
- UI Root (3D) (UI Panel)
      - Camera
            - GUI #1
                   - Panel (UI Panel)
            - GUI #2
                   - Panel (UI Panel)
            - GUI #3
                   - Panel (UI Panel)


Each panel contains the different NGUI functions depending on what type of GUI we wanted it to be. Any help you can provide for us will be greatly appreciated. Thanks!

joreldraw

  • Guest
Re: Depth Pass causing game to crash
« Reply #1 on: June 25, 2012, 10:16:33 AM »
If you have recieving "null reference exception" is because your calling a disable object with your code.

Try to debbug this first.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Depth Pass causing game to crash
« Reply #2 on: June 25, 2012, 12:35:38 PM »
Make sure the "Depth" shader is actually present on the device. It's in the resources folder by default. I'd start debugging by checking for null after the shader gets loaded after
  1. Shader shader = Shader.Find("Depth");
(Line 184 of UIDrawCall.cs)

PhykenMedia

  • Guest
Re: Depth Pass causing game to crash
« Reply #3 on: June 25, 2012, 01:11:19 PM »
You are correct, the shader is coming up null on the device.  It's located in the place you mentioned in the project.

Is there a known way to get this shader to load onto IOS devices, or is that just a hardware limitation?

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Depth Pass causing game to crash
« Reply #4 on: June 25, 2012, 01:25:18 PM »
I don't know why it wouldn't be. It's not even a shader per say, it's just a set of fixed-function pipeline instructions that work even without shader support. As long as it's in the Assets/Resources folder, it should be loadable just fine.

PhykenMedia

  • Guest
Re: Depth Pass causing game to crash
« Reply #5 on: June 25, 2012, 02:59:58 PM »
Thanks for the quick responses! We're going to keep looking into it to see why we're having this issue. We'll make sure to report back any findings!