So there is that BillboarRenderer I could be interested in using, but it requires BillboardAssets, and even going through the manual, I don’t find it all clear on how to make one.
Unable to find a tool to make said BillboardAssets, I tried making a monobehaviour that would let me programatically set the renderer’s asset, and tried to tweak the different available properties… to no avail. The code doesn’t seem to throw any error, but the game object remains desperately invisible with any configuration.
What I feel I am missing are means to properly set the texture atlas and the mesh.
This is the component I’ve been using to trying setting the renderer’s BillboardAsset :
using UnityEngine;
using UnityEditor;
[CustomEditor(typeof(BillboardBuilder))]
public class BillboardBuilderEditor : Editor {
public override void OnInspectorGUI(){
if (GUILayout.Button ("Update Now"))
((BillboardBuilder)target).Build ();
DrawDefaultInspector ();
}
}
public class BillboardBuilder : MonoBehaviour {
public Material _material;
public float _Bottom, _height, _width;
public Vector4[] _ImageCoordinates;
public Vector2[] _vertices;
public ushort[] _ushorts;
public void Build (){
var renderer = this.GetComponent<BillboardRenderer> ();
var bill = new BillboardAsset ();
bill.bottom = _Bottom;
bill.height = _height;
bill.width = _width;
bill.material = _material;
bill.SetImageTexCoords (_ImageCoordinates);
bill.SetVertices (_vertices);
bill.SetIndices (_ushorts);
renderer.billboard = bill;
Debug.Log ("Done");
}
}