According to the Unity Script Reference WWW.LoadImageIntoTexture page, "if the data is not a valid image, the generated texture will be a small image of a question mark." Is there any way to change the question mark or at least get a return from the error, so that I could replace the texture manually? Thank You.
asked Jul 12 '11 at 10:56 AM
Warwick Allison's suggestion (of comparing to a "known-failed" image) is probably the best, most future-proof option. Another possibility which is a little simpler, but will fail if unity ever changes the appearance of the default "error" texture, is to convert your texture into an array of bytes using EncodeToPNG(), and compare the array to a predetermined array representing the PNG-encoded version of the default "error" texture.
I have implemented an example of Warwick Allison's suggestion, plus the other technique I suggest, here: http://www.unifycommunity.com/wiki/index.php?title=TextureBogusExtensions
I implemented it as a C# extension method on the Texture class, which may be overkill. But people keep asking this question on the #unity3d IRC chat channel, so I figured I'd put the code out there.
answered Sep 30 '11 at 06:42 PM