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

UIElements UnityEditor assets used for runtime code compiled into players

Discussion in 'UI Toolkit' started by nateblessing, Apr 17, 2020.

  1. nateblessing

    nateblessing

    Joined:
    Apr 17, 2020
    Posts:
    10
    The problem that I am running into is using ToolbarMenu object in a script, the UXML is being referenced via a Panel Renderer to achieve UXML UI during runtime.(I used the tanks project as reference from the copenhagen talk)

    I am getting an error during build, "The type or namespace name 'UIElements' does not exist in the namespace 'UnityEditor' (are you missing an assembly reference?)"

    The documentation clearly states the the UnityEditor can not be referenced by runtime code compiled into players. "The UnityEditor assembly implements the editor-specific APIs in Unity. It cannot be referenced by runtime code compiled into players."

    Is there a way to reference toolbar objects in scripts for UIElements UXML for runtime code compiled into players?
    Is there another assembly outside of UnityEditor that I can reference instead?
    Is there a way to include circumvent the UnityEditor assembly restrictions?

    If I did something wrong with the post, my bad, this is my first post.
     
  2. nateblessing

    nateblessing

    Joined:
    Apr 17, 2020
    Posts:
    10
    HugoBD-Unity likes this.