Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.

Question How to get a Texture2D from a UnityEngine.VisualElement?

Discussion in 'Documentation' started by RA_Prion_exe, Oct 12, 2022.

  1. RA_Prion_exe

    RA_Prion_exe

    Joined:
    Aug 2, 2021
    Posts:
    4
    I need to paint the content of a GraphView into a UnityEngine.Button (UIBuilder Button). I thought there was some way to export a Texture2D from any VisualElement since you can add non-VisualElement content to a VisualElement through code with the MeshGenertionContext, which uses a Texture2D in the process, but so far I've found nothing. Does anyone have a clue on how I can accomplish this?

    https://docs.unity3d.com/ScriptReference/UIElements.MeshGenerationContext.html
    https://docs.unity3d.com/ScriptReference/UIElements.VisualElement-generateVisualContent.html