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.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

Display 3d game object inside VisualElement?

Discussion in 'UI Toolkit' started by bigdaddy69dev, Sep 22, 2021.

  1. bigdaddy69dev

    bigdaddy69dev

    Joined:
    Jul 10, 2021
    Posts:
    13
    I'm thinking to build my game UI using UI Toolkit. Normally when using canvas, we can display 3d game objects inside canvas using render texture. But is it possible to show 3d game objects inside VisualElement in UI Toolkit? If possible, can someone pls enlighten me how to do it? If not possible, how can I effectively combine canvas and UI Toolkit elements to achieve displaying 3d game object in my game UI?
     
  2. griendeau_unity

    griendeau_unity

    Unity Technologies

    Joined:
    Aug 25, 2020
    Posts:
    230
    Yes, you can set the background image of a VisualElement to use a RenderTexture. It is doable via the Builder like so:

    upload_2021-9-22_16-47-38.png

    It works with both inline styles and stylesheet classes.
     
  3. bigdaddy69dev

    bigdaddy69dev

    Joined:
    Jul 10, 2021
    Posts:
    13
    Thanks for the answer. I was using Unity version 2021.1.22f1 and the render texture feature is not included yet. I can see the feature in 2021.2.0b7 beta version but since this is a beta version, I don't want to make my project with this unity version. It seems like the feature is not included in a stable release yet.
     
  4. bigdaddy69dev

    bigdaddy69dev

    Joined:
    Jul 10, 2021
    Posts:
    13
    Opps!! I was upgrading my existing project to Unity 2021.1.22f1 and the render texture feature was not showing up. Now, I created a new project and installed packages fresh, the render texture feature shows up. I'll just work around to upgrade my existing project into 2021.1.22f1. Thanks.
     
    griendeau_unity likes this.