Hi Guys,
So I want to use one texture for my graphics. I want to put those graphics on a plane, and want to add the position of a graphic into the inspector.
![alt text][1]
I am using this code
using UnityEngine;
using System.Collections;
public class Art : MonoBehaviour
{
Mesh mesh ;
Vector2[] uvs ;
void Start()
{
mesh = GetComponent().mesh;
uvs = mesh.uv;
uvs[0] = new Vector2(0.0f, 1.0f);
uvs[1] = new Vector2(0.0f, 0.0f);
uvs[2] = new Vector2(1.0f, 1.0f);
uvs[3] = new Vector2(1.0f, 0.0f);
mesh.uv = uvs;
for (var i = 0; i < uvs.Length; i++)
Debug.Log(uvs[i]);
}
}
Problem one I have is that the image is rotated 90 degrees.
Problem two I have is how can I add the pixel position of a graphic
I know there are a lot of posts about this. But they only work on cubes. When I try them on quads it isn't working.
[1]: http://dennisjongmans.nl/wp-content/uploads/2013/09/idea.jpg
↧