- Home /
The question is answered, right answer was accepted
iOS External Display not working
Hi, I'm doing a project that needs external display use on iOS device. I saw that unity's Display.displays is avaliable for iOS, and it DID work on one test project. But the same code just don't work on the other project, and I tried everything to find the problem but no solution..
int currentDisplayCount=0;
IEnumerator CheckExternalDisplays(){
while(true){
if(currentDisplayCount != Display.displays.Length){
Debug.Log ("# of External Displays : " + Display.displays.Length);
if(Display.displays.Length > 1){
Debug.Log ("Disp1 SystemWidth, SystemHeight : "
+ Display.displays[1].systemWidth +"x"+Display.displays[1].systemHeight);
Display.displays[1].Activate();
Display.displays[1].SetRenderingResolution(1920, 1080);
Debug.Log ("Set to FHD. \nDisp1 SystemWidth, SystemHeight : "
+ Display.displays[1].systemWidth +"x"+Display.displays[1].systemHeight);
Debug.Log ("Disp1 Resolution : "+Display.displays[1].renderingWidth+"x"+Display.displays[1].renderingHeight);
for(int i=0 ; i<cams.Length ; i++){
cams[i].SetTargetBuffers(Display.displays[1].colorBuffer, Display.displays[1].depthBuffer);
}
}else{
Debug.Log("Disp0 Resolution : " + Display.displays[0].renderingWidth+"x"+Display.displays[0].renderingHeight);
for(int i=0 ; i<cams.Length ; i++){
cams[i].SetTargetBuffers(Display.displays[0].colorBuffer, Display.displays[0].depthBuffer);
}
}
currentDisplayCount = Display.displays.Length;
}
yield return new WaitForSeconds(1f);
}
}
this ienumerator periodically checks for external display. when it detects there are more than one display available then it activates the first external display(Display.displays[1]), set its resolution to FHD(which is known display), then changes the cameras' targetbuffers to that display.
and the odd thing is, when the code sets the external displays resolution to FHD, it in fact changes my devices resolution(iPhone6) to that, making the device screen cropped. And the external display shows nothing. The opposite had happened with test project. Black Device display, FHD rendering on external display.
I checked everything I can think of, compare the build settings, etc... but nothing.
Can you guys check this for me?
further research shows that the device resolution stays the same. only the cameras that are set to draw on the external display are affected. Those cameras' "SetTargetBuffers()" is not properly working. when the external display is plugged in, those cameras' drawing resolution( each camera's "Viewport Rect" property) is changed, but the targetbuffers are not changed. Hence it looks like the screen is "Cropped"
Finally got the problem. I was using FishEye effect from standard assets to those camera, and that script causes the problem. I have to dig more to modify the script..
Follow this Question
Related Questions
WebCamTexture zoomed in on iPad Pro 1 Answer
how to request location , camera permission during run time ? 0 Answers
iOS + Android: Camera Feed in Unity 0 Answers
how to get 4:3 non cropped WebCamTexture in iOS 0 Answers
iOS front facing camera 1 Answer