Problems using built-int icons

cc @uDamian @martinpa_unity @griendeau_unity

I am trying to use the included icons but it is difficult to use them for the following reasons:

  • In the table on the mentioned page there is no preview of any icon.
  • There is no sample with all the icons in Window > UI Toolkit > Samples.
  • There is no way to physically see in a folder all the paths mentioned in that page, it is something internal to the Unity source code that is not possible to see it in the editor installation directory.
  • When you create a style in UI Builder it doesn’t resolve it correctly and you can’t see it.

This uss:

image.

Leads to this error in UI Builder:

image

But in the preview of the uxml asset you can see it:

Hi @bdovaz,

In the UI Builder, are you using an editor theme or a runtime theme? Some of these variables are only defined in the editor themes, --unity-icons-plus is one of them.

Hope this helps!

As far as I see there is no way to import the editor theme? In 2021 at least it was like that, is it still like that?

I mean, themes can only be used in runtime and in editor you have to use stylesheet as the only option?

Can you also answer me about the icons that I mention in points 1 to 3 of my original message? Thank you.

As far as I see there is no way to import the editor theme? In 2021 at least it was like that, is it still like that?

I mean, themes can only be used in runtime and in editor you have to use stylesheet as the only option?

In the UI Builder, you can select a theme for preview purposes (see the dropdown above #4 on this image). That theme and the stylesheets that you will have added to the document will be used to resolve the variable. So in the case of trying to resolve an editor-only variable, if the UI Builder preview theme is a runtime theme, that variable will not be resolved.

Inside the inspector, it’s using the current editor theme, which might explain why it’s working there.

Can you also answer me about the icons that I mention in points 1 to 3 of my original message? Thank you.

My apologies, I didn’t know they needed an answer.

  • In the table on the mentioned page there is no preview of any icon.

This is correct. I’ll ask to see if they can be included.

  • There is no sample with all the icons in Window > UI Toolkit > Samples.

This is also correct. The samples window is mostly about showcasing the controls and not the variables.

  • There is no way to physically see in a folder all the paths mentioned in that page, it is something internal to the Unity source code that is not possible to see it in the editor installation directory.

Also correct, this has been the case of built-in resources of the editor for a long while. They are packed together and bundled with the installation. Those files are located in Data/Resources/ (there is unity default resources, unity editor resources and unity_builtin_extra). I agree the assets included in those are not very discoverable, but very unlikely to change anytime soon.

In the UI Builder, you can select a theme for preview purposes (see the dropdown above #4 on this image). That theme and the stylesheets that you will have added to the document will be used to resolve the variable. So in the case of trying to resolve an editor-only variable, if the UI Builder preview theme is a runtime theme, that variable will not be resolved.

Inside the inspector, it’s using the current editor theme, which might explain why it’s working there.

Today I discovered, which by the way is not very intuitive to find these 2 options:

@martinpa_unity you have not answered me to the last message where I mention a thread of a colleague of yours where he responds that it is not possible to reference a Unity editor topic as if it is possible with the runtime one. That answer is from 2021, is it still like that?

Also correct, this has been the case of built-in resources of the editor for a long while. They are packed together and bundled with the installation. Those files are located in Data/Resources/ (there is unity default resources, unity editor resources and unity_builtin_extra). I agree the assets included in those are not very discoverable, but very unlikely to change anytime soon.

But it is not possible to view those files, right? I mean, they are not a zip file or something that can be unpacked to see its content. That being so I don’t care if that file is in that path if I’m not going to be able to see its contents.

That answer is from 2021, is it still like that?

Yes, you can set a theme at runtime through the PanelSettings, but in editor windows, the editor themes are set automatically. You can’t import the editor themes at the moment, that still holds true.

But it is not possible to view those files, right? I mean, they are not a zip file or something that can be unpacked to see its content. That being so I don’t care if that file is in that path if I’m not going to be able to see its contents.

You can’t view the content of the files directly, no. I provided the path so that you could see for yourself that the resources are not browsable, which you already knew from your original message. You did ask me to give you an answer :wink:

1 Like