I just read your comments and even after your long phrased question you still haven’t mentioned any auto-alignment or auto-fitting. If you need something like that why don’t use use one of those packages like the spritemanager? People usually invent toolkits or tools to be used in many situations. Most the time you need more than one sprite. You said the plane that comes with Unity is bad (due to 121 verts and 200 tris so you want a 2 tris mesh). If you worry about the tris why don’t you use the spritemanager then? For example 4 such sprites with seperate renderers will produce 4 drawcalls. The tris isn’t that important. It’s the fact that each of them need a renderer. That’s why those toolkits pack all sprites into one mesh so it just needs one drawcall.
If you really need exactly one of these sprites, you can just use the plane mesh in Unity, import a 2 tris mesh from your favourite model app or create it procedural.
If you attach the following script to an empty gameobject it will create a 1x1 mesh along the x-y plane, so it’s facing toward positive z (forward) axis.
//C#
using UnityEngine;
using System.Collections;
public class Quad : MonoBehaviour {
public Material material;
void Start() {
gameObject.AddComponent<MeshRenderer>().material = material;
Mesh mesh = gameObject.AddComponent<MeshFilter>().mesh;
mesh.Clear();
mesh.vertices = new Vector3[] {new Vector3(-0.5f, 0, -0.5f), new Vector3(0.5f, 0, -0.5f), new Vector3(0.5f, 0, 0.5f), new Vector3(-0.5f, 0, 0.5f)};
mesh.uv = new Vector2[] {new Vector2(0, 0), new Vector2(0, 1), new Vector2(1, 1), new Vector2(1, 0)};
mesh.triangles = new int[] {0, 1, 2, 2, 3, 0};
}
}
To rotate an object towards another object (if noone is given it will choose the main camera), just attach this script:
//C#
using UnityEngine;
using System.Collections;
public class LookAt : MonoBehaviour {
public Transform target;
void Start() {
if (target == null && Camera.main != null)
target = Camera.main.transform;
}
void LateUpdate() {
if (target == null) return;
transform.LookAt(target);
}
}
Now you have a 2 tris quad mesh which will automatically rotate itself towards the camera or towards any given object.