Skip to content

Instantly share code, notes, and snippets.

@flarb
Created February 18, 2013 20:53
Show Gist options
  • Save flarb/4980627 to your computer and use it in GitHub Desktop.
Save flarb/4980627 to your computer and use it in GitHub Desktop.
Converts pixel coordinates in a texture to UV coordinates in Unity3D.
Vector2 uv = new Vector2((float)myMarker.pixelCoords.x / (float)renderer.material.mainTexture.width, 1f - (float)myMarker.pixelCoords.y / (float)renderer.material.mainTexture.height);
@strikeric11
Copy link

what is uv coordinates?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment