Crashes when using camera.SetTargetBuffers on IOS11 if external display is attached

Unity crashes on IOS11 if external display is attached

XCode Version 9.0 beta 6 (9M214v)
Unity 2017.1.1p1
IOS 11 beta.

  1. Build your app to your device
  2. Attach external display
  3. Start the app.

I copied the code exactly from the example in the documentation:

public class TTDisplay : MonoBehaviour
{
    public Camera itsExternalCamera;
    public Camera itsMainCamera;

    void Start()
    {
        // GUI is rendered with last camera.
        // As we want it to end up in the main screen, make sure main camera is the last one drawn.
        itsExternalCamera.depth = itsMainCamera.depth - 1;

        itsMainCamera.SetTargetBuffers(Display.main.colorBuffer, Display.main.depthBuffer);
        itsExternalCamera.enabled = false;
    }

    void Update()
    {
        if (Display.displays.Length > 1 && !itsExternalCamera.enabled)
        {
            Display.displays[1].SetRenderingResolution(256, 256);
            itsExternalCamera.SetTargetBuffers(Display.displays[1].colorBuffer, Display.displays[1].depthBuffer);
        }
        itsExternalCamera.enabled = Display.displays.Length > 1;
    }
}

I submitted a bugreport today. Anyone else has this issue?
Best wishes,

Michal

We can reproduce this crash only on IPad Air1 at the moment. IPad Pro is working fine.

Found a similar crash using XCode 9.1 beta build iOS 11. Every time I enter a scene with a custom shadow rendered by a render texture, it crashed.

The log says ’ … texture at depth attachment has usage … ’

After a little search, one said, metal need a rendertexture to marked with MTLTextureDescriptor, otherwise an exception will be thrown.

Then I build the game with GLES 3.0 instead of metal, and it never crashed.

So I think I’ve nailed the issue. the question is when will Unity upgrade to solve that?