Skip to main content

UVs and Animation

  • Chapter
  • First Online:
Learn Unity for 2D Game Development
  • 1815 Accesses

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.

This is a preview of subscription content, log in via an institution to check access.

Access this chapter

Chapter
USD 29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
eBook
USD 39.99
Price excludes VAT (USA)
  • Available as EPUB and PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
USD 54.99
Price excludes VAT (USA)
  • Compact, lightweight edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info

Tax calculation will be finalised at checkout

Purchases are for personal use only

Institutional subscriptions

Author information

Authors and Affiliations

Authors

Rights and permissions

Reprints 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

Publish with us

Policies and ethics