Author Topic: Keywords From shader doesn't match with Unity info  (Read 315 times)

Edu9231

  • Newbie
  • *
  • Posts: 4
    • View Profile
Keywords From shader doesn't match with Unity info
« on: May 14, 2020, 09:45:36 AM »
Hi!

I have the 256 keywords limit issue and I'm trying to reduce the keywords. Shader control says that I have 8 keywords on a shader ( I made with Amplify) which doesn't. I don't know where those keywords come from but if i check the amplify shader there are no multicompile or shader features in it. Also it says that the shader is being used by 1 material while it's being used by 3 materials.
I've tryed to remove the unity shader cache and reimport launching unity again but is still giving me this information.  What do you think it could be wrong? What are those keywords?
The first image it shows the info from Shader control and the second shows the shader info compiled by unity.

Any idea?

Thanks you in advance

Kronnect

  • Administrator
  • Hero Member
  • *****
  • Posts: 5733
    • View Profile
Re: Keywords From shader doesn't match with Unity info
« Reply #1 on: May 14, 2020, 10:24:05 AM »
Please specify the full path of the shader and also provide a copy of it here. Thank you.

Edu9231

  • Newbie
  • *
  • Posts: 4
    • View Profile
Re: Keywords From shader doesn't match with Unity info
« Reply #2 on: May 14, 2020, 10:41:15 AM »
Here is the path where i have the shader.

D:\WorkSpace\PlayStark\GitHub\Assets\FX\Models\Water_waves

Kronnect

  • Administrator
  • Hero Member
  • *****
  • Posts: 5733
    • View Profile
Re: Keywords From shader doesn't match with Unity info
« Reply #3 on: May 14, 2020, 03:40:41 PM »
Force Scan Shaders is enabled. That forces Shader Control to analyse all shaders in your project, including those outside of a Resources folder. Those shaders might not be included in your build or itís keywords be driven by the materials that use them.

Edu9231

  • Newbie
  • *
  • Posts: 4
    • View Profile
Re: Keywords From shader doesn't match with Unity info
« Reply #4 on: May 15, 2020, 12:49:56 PM »
Yes, that's because this 256 is giving us errors in editor so sometimes something stops working. For example we use vegetation studio pro for adding trees and vegetation. It has some shaders that stops working due to this error. Also sometimes some shaders from Postprocessing also stops working and it affect the frame rate of the game.  We need to be clean in the project because we usually use editor for testing the game.

I made a shader clean up and  if i'm not wrong we are under the limit in the build but still have those errors in the editor. What do you think we could do?


Cheers.

Kronnect

  • Administrator
  • Hero Member
  • *****
  • Posts: 5733
    • View Profile
Re: Keywords From shader doesn't match with Unity info
« Reply #5 on: May 15, 2020, 03:13:07 PM »
According to the screenshots, your build uses 118 keywords. That info is extracted from the build process. Since you get the 256+ keywords limit error, it means you have lot of shaders in your project that's not being used.
Use the "Project View" tag to find shaders and disable its keywords.
This is an unusual case. Normally, when you get the 256+ keyword limit error, it means that you're really using that much of shaders. The number of keywords in the Build View tab usually must be greater than the number of keywords in the Project View.

What does the Project View tab look like? Note that in order to avoid the 256+ limit error, you need to work on the Project View and disable as many shaders or keywords as possible.

(Also restart Unity when doing many shader file changes since keywords are cached in memory and not released until you restart Unity).

Kronnect

  • Administrator
  • Hero Member
  • *****
  • Posts: 5733
    • View Profile
Re: Keywords From shader doesn't match with Unity info
« Reply #6 on: May 15, 2020, 03:34:01 PM »
I've added a new filter option in Project View called "Not Used In Build". Enable this toggle to show shaders in your project that are not included in the last build. This should list shaders that you can safely remove, at least consider that those shaders are not being included in the scenes you have selected for your build.

Edu9231

  • Newbie
  • *
  • Posts: 4
    • View Profile
Re: Keywords From shader doesn't match with Unity info
« Reply #7 on: May 17, 2020, 02:11:02 PM »
Thanks You!, That new Tab will be really useful!

What you said makes totally sense, maybe its because we are using some third parties like Amplify and it carries a lot of shaders in it as i've checked (not from demo projects, we don't import them). But project view should show me all the keywords that are in the project right?  Because I can see in the 256 errors some keywords that doesn't appear in the project view list. That makes me think that there are not all the keywords in the list.

For example this error:   Maximum number (256) of shader keywords exceeded, keyword _NODE_2441_ON will be ignored. 

I think this '_NODE_2441_ON' keyword comes from amplify shader but would be helpful to know which shaders are using it.

Kronnect

  • Administrator
  • Hero Member
  • *****
  • Posts: 5733
    • View Profile
Re: Keywords From shader doesn't match with Unity info
« Reply #8 on: May 20, 2020, 09:45:19 AM »
Version 5 beta 1 is now available with support for shader graph shaders. Give it a try and see if those node-based keywords show up in both Project and Build View. You now should filter and locate them with ease.