Search Unity

Help with Graphic script to utilize a SpriteAtlas

Discussion in 'UGUI & TextMesh Pro' started by MongooseJV, Feb 23, 2018.

  1. MongooseJV

    MongooseJV

    Joined:
    Feb 25, 2014
    Posts:
    20
    So I have a Graphic component to render icons using the OnPopulateMesh override. I understand how to add vertices and their related UVs using the provided VertexHelper object. The problem is trying to get the different icons to show using a SpriteAtlas.

    From what I can gather, you can override the mainTexture property directly tied to the vertices being populated in OnPopulateMesh. Unity doesn't seem to provide a method to return the entire texture atlas in this case.

    My goal is to be able to place icons efficiently using the Graphic component. I'm injecting icons inside text blocks to make helpful tooltips. If this is not supported, what are the other ways to do this efficiently without providing a separate texture for every UI icon?

    Thanks,
    - jeff