WorldUVs

Author: Aubrey Falconer (Robur)

Special recognition: Mike_Mac, Azupko

Description


Recursively generates UV maps for mesh faces so that they all line up with each other in world space. Want to create a world out of scaled and rotated cubes, then add a seamless texture to them all? This script is what you need!

Usage
You must place the script in a folder named Editor in your project's Assets folder for it to work properly.

When you are ready to generate new UVs for your world; select your parent world object in the Inspector, and then run the "GameObject > World Space UVMap" menu command.

JavaScript - WorldUV.js
This algorithm is quite simple, but also very effective. It determines the nearest cardinal direction to each face, then textures the face in that direction's plane.

JavaScript - WorldUVAdvanced.js
This algorithm is more advanced than the preceding one, but it doesn't always work. It attempts to texture each mesh face in it's own plane. If you can figure out what is wrong with this script, please post your revised code!