Abstract
The previous chapter explained how to develop a GUI editor add-in that allows users to add selected textures in the project panel to a larger atlas texture. Atlas Textures help us improve the performance of our 2D games. In generating the atlas, we also saved meta-data. This included all filenames of textures inside the atlas, and their UV positions within the atlas. In closing that chapter, we tested the add-on functionality by assigning an Atlas Texture to a procedural Quad Mesh in the scene, to see how it looked in the Viewport. The problem we faced was that the quad mesh rendered the complete atlas texture, rather than just a region of it (see Figure 7-1). The problem was not with the Atlas Texture, but with the mesh itself; with its UV mapping. By default, the UV mapping for Quad Meshes is configured to show a complete texture. To show only a region, the UV mapping must be adjusted at the vertex level. That is, we must dig deeper into the mesh construction and edit its vertices. We’ll do that in this chapter, as we create a new editor add-in to control mesh UV mapping. This add-on lets us select a textured quad in the scene and entirely customize its UV mapping to show any region within the Atlas Texture (or within any texture!). In addition, we’ll also create another class to change UV mapping over time, creating a flipbook animation effect or an animated sprite effect.
Access this chapter
Tax calculation will be finalised at checkout
Purchases are for personal use only
Author information
Authors and Affiliations
Rights and permissions
Copyright information
© 2013 Alan Thorn
About this chapter
Cite this chapter
Thorn, A. (2013). UVs and Animation. In: Learn Unity for 2D Game Development. Apress, Berkeley, CA. https://doi.org/10.1007/978-1-4302-6230-5_7
Download citation
DOI: https://doi.org/10.1007/978-1-4302-6230-5_7
Published:
Publisher Name: Apress, Berkeley, CA
Print ISBN: 978-1-4302-6229-9
Online ISBN: 978-1-4302-6230-5
eBook Packages: Professional and Applied ComputingProfessional and Applied Computing (R0)Apress Access Books