Hello Guest

Author Topic: Black Textures on iPad and some android  (Read 7093 times)

Wuzseen

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 9
    • View Profile
Black Textures on iPad and some android
« on: October 10, 2013, 02:59:22 pm »
Some sprites from my atlases are showing up black when I actually go to device.  At the same time though, some sprites DO work.

I have built all atlases to be 1024x1024 (or less) and am fairly certain that is not the problem.

The sprite that does work is using the same shader as the sprites that don't.

Basically the whole texture is just a black box.

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: Black Textures on iPad and some android
« Reply #1 on: October 10, 2013, 03:28:08 pm »
Black textures in Unity usually mean either the texture is larger than the supported dimensions (iPad mini limit = 2048) but in this case it doesn't look like thats the case. The other thing that could potentially cause this is your game's out of texture memory...

Wuzseen

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 9
    • View Profile
Re: Black Textures on iPad and some android
« Reply #2 on: October 10, 2013, 03:49:22 pm »
Being out of memory seems unlikely to me.  The sprite that is loading is instantiated quite a few times and I see newer versions of this just fine whereas the black boxed textures are pooled on app launch for the most part; there is a couple non-pooled sprites that are still drawn black.  This problem existed before I pooled these sprite objects so I don't think that's the root of it either.  So the Instantiated objects, which would be grabbing more and more memory, are mostly fine.

One thing I noticed in the inspector that is unique to the sprite that is working just fine, there is no material in its inspector view.  The mesh filter lists the material for the atlas, but the material isn't in the inspector.  On the sprites that are broken, the mesh filter lists the material and the material itself is in the inspector free for me to modify.
« Last Edit: October 10, 2013, 04:20:26 pm by Wuzseen »

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: Black Textures on iPad and some android
« Reply #3 on: October 10, 2013, 05:14:30 pm »
I can't think of any reason the material would be hidden in the inspector. Is there anything special about them? I suppose the next thing to do is to find one thats broken, then assign the sharedMaterial to something else, or writing some other debug code to inspect the scene at runtime. tk2d doesn't do anything to the materials (except instantiate them if you're using platform sprites).

Also, do you unload sprite collections at any point?

Wuzseen

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 9
    • View Profile
Re: Black Textures on iPad and some android
« Reply #4 on: October 10, 2013, 05:16:12 pm »
As far as I can tell, the only unique thing about the working sprite is that it is in its own atlas.  But that atlas has the same settings as the two others that are broken.

How do you mean unload sprite collections?  I've been hacking together my 2dtk knowledge to an extent.

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: Black Textures on iPad and some android
« Reply #5 on: October 10, 2013, 05:17:41 pm »
Does everything from that atlas work, or is it just one sprite from the atlas that doesn't?
If everything from that atlas isn't working, drag the atls material onto a Unity plane / cube and run the game. Is it working then?

Wuzseen

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 9
    • View Profile
Re: Black Textures on iPad and some android
« Reply #6 on: October 10, 2013, 05:20:30 pm »
The sprite that is working, is the only object in its atlas.  The sprites that are not working share multiple sprites in a single atlas.

I'll give your suggestion a go when I can.  The devices the problem is present on I don't quite have the quickest workflow with yet.  My personal device it works just fine on (a galaxy s3) but on some people's S4s, other android devices, and an iPad I have built to, this problem is present