Search Unity

2D MeshInstanceRenderer question

Discussion in 'Graphics for ECS' started by dtandersen, Aug 6, 2018.

  1. dtandersen

    dtandersen

    Joined:
    Feb 5, 2016
    Posts:
    1
    I was wondering how to do this without a prototype. Specifically, how to create a mesh on the XZ plane (I believe that faces the camera) with a PNG image on it.

    Also, is this the best way to go about rendering sprites? I've seen that someone made a SpriteInstanceRenderer.

    https://github.com/Unity-Technologi...ure/Assets/GameCode/TwoStickBootstrap.cs#L107

    Code (CSharp):
    1.         private static MeshInstanceRenderer GetLookFromPrototype(string protoName)
    2.         {
    3.             var proto = GameObject.Find(protoName);
    4.             var result = proto.GetComponent<MeshInstanceRendererComponent>().Value;
    5.             Object.Destroy(proto);
    6.             return result;
    7.         }