Layer displaying in Editor, not on iPhone

Hello there,

My apologies if this topic is the copy my post in some other thread of iPhone dev forums, but this is very dev breaking for me. As dev deadline is approaching, I want to be sure that this is read properly.

This is also stopping me from buying Unity Pro + iPhone Advanced, to be honest, as I currently can’t tell if it’s a bug at all.

So here it is : I have some difference between Unity iPhone editor and my iPhone screen :

Set 2 cameras, one rendering a normal 3D scene in Layer 8, and a second ortographic rendering the HUD in Layer 9.

cam1 has clear Flags on skybox and is depth 0, cam2 has depth 10 and clear Flasg on Depth only.

In iPhone Unity, I can see the HUD, but on the iPhone, it has disappeared …

I’ve tested multiple manipulations, like setting the 3D objects to Layer 9, setting the cam2 to perspective mode, setting cam2 to Layer 8…

Just no good, the top layer won’t never show on iPhone.

If it can help, I’ve set 2 GUI Text in the HUD Layer, and they are properly shown on iPhone.

Seems that only 3D objects can’t show on (the whole HUD is made of 3D planars).

I already submitted a bug report under sotfware, but as once again, I’m not sure if it’s a bug at all, this topic is here.

Are there some more tricks to do for that top layer to be shown on iPhone ?

Does iPhone even support multiple layers ?

Thank you for your attention :slight_smile:

Ok, after 5 hours of research and different debugging sessions, I finally found what was the problem : the shader.

Stupid me, I should have guessed it from scratch …

My apologies for the red-alert-type thread I made here …

The one I used is this one, which is a stripped version of some transparent shader in the Unity shader ZIP :

Shader "_simpleTexture" { 
   Properties { 
   	_Color ("Main Color", Color) = (1,1,1,1)
      _MainTex ("Base (RGB) Trans (A)", 2D) = "white" {}
   } 

	
   SubShader { 
      Pass { 
      	Alphatest Greater 0
	Blend SrcAlpha OneMinusSrcAlpha 
      	Cull Off
         SetTexture [_MainTex] 
      } 
   } 
   }

It’s minimalist, so I can’t see for now what’s wrong. Starting the diggin out.

edit : I’d just like a basic 2D sprite shader, with no lighting, just displaying PNGs with alpha.

Ok, I don’t know why, but Unity shaders sources in the zip provided by Aras just don’t render to iPhone. I have to use built-in shaders, like Transparent/VertexLit.

Damn, 8 hours of researches to learn what shader works on iPhone, that’s a bit rude :cry:

No offense guys, but Unity iPhone needs more centralised documentation, it’s a real mining job to succeed at bringing the WYSIWYG component to life :wink:

Anyway, now I got a beautiful HUD with two 800 polys 3D chars moving onscreen at 40 fps, thanks to Unity.

Let’s move on.

There are no shaders on the iphone
You only have combiners on the iPhone so any shader that has anything related to CG in, has a render texture or a cubemap will not work unless it has a fallback shader that will work.

Yes, I read that many times in here during my researches, but couldn’t dig the hell out of what it was supposed to mean, like what does CG mean, which part of the shader structure was unread by the iPhone…

I did have to guess that assigning a shader to a material variable with Shader.Find didn’t work too. We got to assign a first shader variable, and then assign it to the material one.

A real mining job, that iPhone developping :wink:

Anyway thank you for your tips Dreamora, and congrats for your Realm Crafter :slight_smile:
I realize how huge such a project is to realize.