I know this question is pretty old, but thereThere is a way to do this without SpriteRenderers using Graphics.DrawMesh(). You can use this method to draw sprites by using properties that sprites have like vertices, triangles, uv, texture, etc. to construct a mesh and appropriate material.
EDIT: Example Here is an example
public class SpriteDrawer : MonoBehaviour {
// A list of textures we want to build materials for beforehand
// Using the same material saves draw calls
public List<Texture2D> textures;
public Material spriteMaterial;
Dictionary<Texture2D, Material> textureMats = new Dictionary<Texture2D, Material>();
public void Awake() {
//fill up textureMats with materials
foreach (Texture2D texture in textures) {
textureMats.Add(texture, new Material(spriteMaterial) {
mainTexture = texture
});
}
}
public void Draw(Sprite sprite, Vector3 pos) {
Material mat;
//check if we already made a prebuilt material, otherwise make a new one
if (textureMats.ContainsKey(sprite.texture)) {
mat = textureMats[sprite.texture];
} else {
mat = new Material(spriteMaterial) {
mainTexture = sprite.texture
};
}
//build a mesh for the sprite
Mesh mesh = new Mesh() {
vertices = Array.ConvertAll(sprite.vertices, x => (Vector3)x),
triangles = Array.ConvertAll(sprite.triangles, x => (int)x),
uv = sprite.uv
};
Graphics.DrawMesh(mesh, Matrix4x4.TRS(pos, Quaternion.identity, sprite.bounds.size), mat, 0);
}
}
NOTE: I haven't tested this script so it may or may not work