UIElements UnityEditor assets used for runtime code compiled into players

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.

For any who find this in the near future, I got a response from the unity team on another thread, Runtime first thoughts and a question

“It’s already on our radar. We plan to move some of the controls from UnityEditor.UIElements to UnityEngine.UIElements, but we still don’t know when it will happen and which controls will go first.”

1 Like