Unity 4.1 Airplay: missing docs

it was brought to our attention that some Display class members are not documented. While it is straightforward to deduce their meaning - it is hard to do when you dont know what are you looking for :wink:
here they are:
int renderingWidth, renderingHeight
these are the the rendering resolution
int systemWidth, systemHeight
these are real display resolution
** An example: if you grab 1080p display and call SetRenderingResolution(256,256), then renderingWidth/Height will be 256x256 and system ones will be 1920x1080
RenderBuffer colorBuffer, depthBuffer
these are OpenGL ES buffers that you should use to render to this display. Use in conjunction with Camera.SetTargetBuffers.
Also, please check usage sample here:

Ok and how do i assign a camera to a specific display ?

Camera.SetTargetBuffers
pass buffers from Display
like in a sample here: Unity - Scripting API: Display
P.S. there are some docs missing, but thats not the reason to not read existing ones :wink:

Don’t know if it’s a bug or a limitation currently and don’t know if it’s the right place to ask but…

Got AirPlay working very fast on our game (forma.8) yesterday, very easy following the documentation, however I have a problem: we use three camera in the game right now and I have no problem in using them on the main display, but when mirroring we can only output one single camera on the external display but not a second one. When we switch off the mirroring and reassign in code the camera to the main display everything works as supposed.

Basically we need to have two cameras rendered on the external display (game + HUD), and one on the main display when mirroring (another part of the HUD), but after trying everything possible I can only get one camera to render properly on the external display.

Any idea? :slight_smile:

I cant understand what you are trying to do (maybe too many letters before first coffee ;-)). Can you please bug report with small repro project? As i understand you dont need to draw all your game to show the bug, right?

Ok nevermind… it was a mistake on my part, a stupid syntax error! Too much code to crunch in two days and I missed it! :frowning:

For anyone who needs it, that’s the code snippet we are using for mirroring the game (three cameras: game, hud and game map, when mirroring only the map shows in the iPad display), derived from the documentation and from here:

Just call DualDisplay() in an Invoke or Update.

var mainCamera : Camera;
var hudCamera : Camera;
var mapCamera : Camera;

function DualDisplay() {

	if ( Display.displays.Length > 1  ) {


					var secondDisplay : Display = Display.displays[1];
					
					Display.displays[1].SetRenderingResolution(1280,720);
					Display.displays[0].SetRenderingResolution(2048,1536);
					
					mapCamera.SetTargetBuffers (Display.main.colorBuffer, Display.main.depthBuffer);
					hudCamera.SetTargetBuffers (secondDisplay.colorBuffer, secondDisplay.depthBuffer);
					mainCamera.SetTargetBuffers (secondDisplay.colorBuffer, secondDisplay.depthBuffer);
					
	}
				else
				
		{

					Display.displays[0].SetRenderingResolution(2048,1536);
					mapCamera.SetTargetBuffers (Display.main.colorBuffer, Display.main.depthBuffer);
					hudCamera.SetTargetBuffers (Display.main.colorBuffer, Display.main.depthBuffer);
					mainCamera.SetTargetBuffers (Display.main.colorBuffer, Display.main.depthBuffer);

				}
				

}

Works (with Airserver), but looks terribly aliased.
Is there a way to get AntiAlias for the secondary display?

well, there are ways yes, but all too hackish. I would say it sounds weird - did you try setting bigger res?

Anybody can help me to understand how AirPlay Mirroring works?

If you connect iPad to AirPlay, the iPad is calculate everything for 2 monitor?

So mirroring cut to half performance if I not disable the camere from one monitor …

It is right?

Up

No, there´s no noticable slowdown on the framerate.
You can define what exactly will be send to the external screen by telling the app what camera should be taken.
If you don´t do any of these changes, the whole app will be send, as every other app will.

Ok so if I send one camera (it is the same) on 2 different monitor there is any slowdown on FPS?

I would say: No slowdown

Dear support,

about 2 hours I try to use AppleTV with my application(build with Unity 4.1.2f4) using AngryAnt gits source Example use of the Unity 4.1 AirPlay API - gives a setup with the iOS device as controller of the remote display. · GitHub.

As you can read in gits other users comment, also I encountered in display.Lenght = 1 Problem.

Unity render my camera in another buffer but cannot stream the content on my TV.

Any solution?

Just for your information:
As far as I know AppleTV and AirPlay are two different things. I haven´t tried AppleTV yet, but AirPlay is really easy:
Use the script above to define what camera will be sent.
Connect via WLAN to a PC/Mac where AirServer (www.airserver.com) is running.
The Airplay symbol appears on your device when you are connected. Hit this symbol to start streaming.

http://www.apple.com/appletv/airplay/

As you can see on Apple website, the AirPlay stream videocontent via AppleTV …

If I use simple default AirPlay mirroring, All works correctly.

But the problem is Unity Display detection …

I need to split my cameras on two display (GUI on Ipad and Main camera on TV like “MetalStorm: Wingman”) but Display.display.Lenght = 1 …So Unity cannot found second monitor …

Thanks

Hello Cascho01,

How would I do that?
How would I send one camera to two displays, as SetTargetBuffers can only take one color/depth buffer?
I’m trying to get a camera to display on both the device and the external screen.

Thanks for your help!

If you just want to get the iPad-Screen mirrored to an external screen you don´t have to do anything in Unity:
Connect via WLAN to a PC/Mac where AirServer (www.airserver.com) is running.
The Airplay symbol appears on your device when you are connected. Hit this symbol to start streaming.

Hi,
I don’t see anything on assigning a camera to several display.
I want to display on both the device AND the external screen.
Is there a way to do that?
Thank you!

No, I want ONE camera to display on both screens, not the whole game.
I know the whole game is mirrored when I don’t do anything on any cameras, but when I call SetTargetBuffers on one camera, every camera starts being displayed on only one screen.
I have cameras that need to be displayed on the device (buttons…), cameras to be displayed on the TV (the game scene), AND cameras to be displayed on both.
Is there a way to do that without duplicating cameras?

Thanks for your answer!