1
NGUI 3 Support / Re: UIAtlasMaker exception
« on: July 30, 2014, 03:34:29 PM »
I recently got the same error as the OP when trying to recreate a texture that was too large. After adding a null check above the error line in UIAtlasMaker (code below), it correctly stopped and showed an error telling me that the texture would be too big. Probably related to Unity trying to resize the texture for us, which means the texture we thought we had is no longer valid.
- ...
- for (int i = 0; i < sprites.Count; ++i)
- {
- Rect rect = NGUIMath.ConvertToPixels(rects[i], tex.width, tex.height, true);
- /******************* ADDED *******************/
- // Check if the texture is gone before using it
- if(textures[i] == null)
- {
- return false;
- }
- /***************** END ADDED! *****************/
- // Make sure that we don't shrink the textures
- if (Mathf.RoundToInt(rect.width) != textures[i].width) return false;
- ...
