private static void UpdateUVs( Uni2DSprite a_rSpriteComponent, Uni2DTextureAtlas a_rTextureAtlas) { Mesh rSpriteQuadMesh = a_rSpriteComponent.spriteQuadMesh; // Update UV Rect oUVRect; Material oQuadSpriteMaterial = a_rSpriteComponent.spriteQuadMaterial; if(a_rTextureAtlas == null) { oUVRect = new Rect(0,0,1,1); } else { oUVRect = a_rTextureAtlas.GetUvs(a_rSpriteComponent.spriteTexture); oQuadSpriteMaterial = a_rTextureAtlas.atlasMaterial; } rSpriteQuadMesh.uv = new Vector2[ 4 ] { new Vector2( oUVRect.xMin, oUVRect.yMin ), new Vector2( oUVRect.xMax, oUVRect.yMin ), new Vector2( oUVRect.xMax, oUVRect.yMax ), new Vector2( oUVRect.xMin, oUVRect.yMax ) }; Renderer rRenderer = a_rSpriteComponent.renderer; if(rRenderer != null) { rRenderer.material = oQuadSpriteMaterial; } if(a_rTextureAtlas == null) { a_rSpriteComponent.atlasGenerationID = ""; } else { a_rSpriteComponent.atlasGenerationID = a_rTextureAtlas.generationId; } }