Problem with Image on Tablet

Hi, I have made a game where I have a game object that is a plane with a image. In PC, everything works fine, but, on my tablet, the plane appears all black. I don’t have any idea about what is causing this…

Does anybody has an idea?

This is my Inspector for this black billboard:

[5535-captura+de+tela+2012-12-05+às+10.25.07.png|5535]

And this is my code for the same object:

public class Fly : MonoBehaviour {

	void Start () 
	{	
		startFly();
	}
	
	//Fly Game Object
	void startFly ()
	{
		Mesh planeMesh = ProceduralMeshes.CreateXYPlane(13, 13);
		GameObject fly = new GameObject(); 
		fly.transform.position = new Vector3(0, 0, 10);
		fly.name = "Fly";
		
		MeshFilter mf = fly.AddComponent<MeshFilter>(); 
		mf.mesh = planeMesh;
		
		MeshRenderer mr = fly.AddComponent<MeshRenderer>();
		mr.material = new Material(Shader.Find("Transparent/Diffuse")); 
		mr.material.mainTexture = Resources.Load("Images/fly") as Texture;

		fly.AddComponent<Movement>();
	}
}

Thks in advance.

I have had 2 kinds of similar issues with gameObjects showing fine on editor and not showing properly on tablets. Maybe one of them works for you too, or give you an idea to look in other places. Probably your issue has nothing to do with billboards, specially if your other buttons that are showing fine are also billboards.

(1) First one is flat gameObject. Whenever I’d set a gameObject with size.z = 0, it wouldn’t pick up lights. Just set it to 0.00001 and you’re good to go.

(2) The second one you already know about it: texture sizes. 4096 is highly unsupported yet.

edit

Well, with all the new information it, I could think of other possibilities which shouldn’t affect android only, but you might have something done script-wise that’s not considering these:

(3) Maybe you’re loading a non-existent texture there. Resources.Load("Images/fly") is trying to find a image file under Assets/Resources/Images/ which should be called “fly” on the editor (be it png, jpg or whatever). But this should show wrong on the editor as well…

Additionally, there’s no need for that procedural mesh. You just need a simple mesh plane there, which you can and should build in the editor. No scripts required. If you need to build it at runtime, use prefabs. Maybe removing so many complication you fix an unknown issue somewhere.

Also there’s another thing that could go wrong there, even using the plane…

(4) If you rotate any of them 180 on the Y axis (supposing it is aligned with the screen height), it will show the invisible side. This is much simpler to fix on the editor and it will show both on editor and on the device as an invisible object.

This happens because meshes have usually only one of their side mapped to render (the UV map).

But, just for further reference, in your script you could add to the startFly:

fly.transform.rotation = Quaternion.Euler(new Vector3(0, 180, 0));

This is usually fixed by using a shader with cull off or building a 2 sided mesh.

lastly

(5) Yet another yet simpler idea: why not using the same “texture” you used on the top fly for your other fly?

I’ve tried on my side using all code you provided and I got no issues at all. Now I’m positive there’s still something missing from this context.

According to this, you actually might have a shader problem (it’s the same symptom). Try to use the right shaders for mobile (they are included in a specific built-in package). Or just try “Unlit/Transparent” shader, as suggested there (you’ll lost light intensity, but I don’t think it will be an issue in your case).

I know this is already answered, but to confirm a possible solution proposed by Cawas, I had the black texture and I ended up having to make my texture a power of 2 (and then stretch it back out on the plane itself) AND ALSO change the texture’s import settings from 4096 to 2048.

I was also using the “Unlit/Texture” shader that some people here mention, and I also changed that to “Self Ilum/Texture” while dropping the color tint to a gray (so it retains it’s intended colors). Kind of a dirty workaround, but I think that this helped solve my problem too. My main point is that there may be more than one cause of your problem and you might need to take more than one action to fix it. None of those 3 solutions worked for me individually, but it works when combined.

It’s also worth noting that I’ve only ever run into this issue on devices that run Android 4.0.3 so far, but your mileage may vary.