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. Dismiss Notice

Customer ShaderGUI warning only on package import

Discussion in 'Scripting' started by HemiMG, Mar 15, 2015.

  1. HemiMG

    HemiMG

    Joined:
    Jan 17, 2014
    Posts:
    911
    Edit: Oy, how do I edit the thread title? It should say custom, not customer. Sheesh.

    I just discovered a bit of a problem with a shader asset I just uploaded to the asset store. When I copy the files over manually, everything works fine. But if I export it to a Unitypackage and re-import it I get a warning that says:

    "MaterialEditor: Could not create custom UI from the CustomEditor: '' of the shader. Does the class name include its namespace? And does the class either derive from ShaderGUI or MaterialEditor?"

    Usually I test import Unitypackages before submitting, figures the one time I didn't there is a problem. The thing is, the custom editor works flawlessly for all of the shaders so I have no clue which one it is even complaining about. A google search for the warning only brought up this one result: http://issuetracker.unity3d.com/iss...ash-speedtree-shader-generate-console-warning so apparently UT themselves have ran across the problem.

    Since it doesn't impact the usage of the asset at all, it isn't a big enough concern for me to pull it from sale on my site, but I am concerned that the asset store team will reject it if it has warnings even if everything works fine, so I would like to fix it and resubmit if possible.

    My custom editor was written by modifying the code for Unity's standard shader custom editor script. It looked like this:

    Code (CSharp):
    1. using System;
    2. using UnityEngine;
    3.  
    4. namespace UnityEditor
    5. {
    6.     internal class ImperialFurShaderGUI : ShaderGUI
    7.     {
    8. // my shader ui code
    9.     }
    10. }
    I looked at the documentation for customer ShaderGUIs and modified it to match those, which is a simple change that, predictably, didn't fix anything:

    Code (CSharp):
    1. using System;
    2. using UnityEngine;
    3. using UnityEditor;
    4.  
    5.     public class ImperialFurShaderGUI : ShaderGUI
    6.     {
    7. // my shader ui code
    8.     }
    The code is in the Editor folder where it belongs. I have no idea what is going on since it works if I create them manually. Could there be some bug in the asset package import process that is causing the shaders to get imported before the editor scripts? That would make sense, since everything works fine once it is imported. It clearly does create the custom UI that it is complaining about not being able to create.

    I've been stressing out so much trying to get this asset ready for release, so it's a bit frustrating to finally have it polished up to where I want it and still be facing a possible rejection. It's even more frustrating since the second version is setup exactly like they tell you to do it. The name called from the shader matches the classname (obviously, or it wouldn't work at all) so I'm really at a loss here. I guess the stress of getting this out isn't over yet. ;-)
     
  2. defaxer

    defaxer

    Joined:
    Nov 15, 2010
    Posts:
    140
    Same here, and error is still not fixed in unity 5.0.1
     
  3. HemiMG

    HemiMG

    Joined:
    Jan 17, 2014
    Posts:
    911
    My shader got approved on the asset store, which was really a huge concern. More importantly no customers have complained or asked about it, what is a much bigger concern. But I would still like a fix. The thing is, I'm not sure if it's a bug that I should report, or it I'm doing something wrong.
     
    mcroswell likes this.
  4. defaxer

    defaxer

    Joined:
    Nov 15, 2010
    Posts:
    140
    My package contained only shader, custom editor and material with that shader. After removing that material warning was gone, but I don't think it's a good solution
     
  5. garrido86

    garrido86

    Joined:
    Dec 17, 2013
    Posts:
    234
    Well I would like to say that I have the same problem, but it doesn't bother me that much to be honest. It would be still nice to know why this message happens, though.
     
  6. Doodayer

    Doodayer

    Joined:
    Sep 18, 2014
    Posts:
    3
    I had this issue with a shader that i downloaded from the asset store, and i fixed it by deleting the imported shader, and making sure that i properly reimported both the shader, and the editor that comes with it. Should be a code file, usually with the same name as the shader.
     
  7. Oscar_Riquelme

    Oscar_Riquelme

    Joined:
    Jul 30, 2015
    Posts:
    4
    Code (CSharp):
    1. using System;
    2. using UnityEngine;
    3. #if UNITY_EDITOR
    4.   using UnityEditor;
    5. #endif
    6.  
    7. #if UNITY_EDITOR
    8.     public class ImperialFurShaderGUI : ShaderGUI
    9.     {
    10.     // my shader ui code
    11.     }
    12. #endif
    success... ;)
     
  8. ModLunar

    ModLunar

    Joined:
    Oct 16, 2016
    Posts:
    372
    Ahh thank you very much! I was trying to put my ShaderGUI class into a namespace, and I guess Unity doesn't like that xD so I just did what you did -- global namespace with a bunch of those compilation directives :I
     
  9. unity_7uocQCFyGTneGA

    unity_7uocQCFyGTneGA

    Joined:
    Apr 10, 2019
    Posts:
    2
    Hi guys ... Could this error result in ugly shading graphics - such as the pictures I attached?
    Screenshot_20190622-222344.png Screenshot_20190622-222344.png
     
  10. DouglasLee

    DouglasLee

    Joined:
    Dec 25, 2013
    Posts:
    3
    I had the same error in Unity 2018. I found I had a .asmdef file with 277 path and file name. After shrinking the file name, the error gone. So you could check if there is any file related to the customer ShaderGUI with path and file name exceeding 260 characters.
     
  11. fule123

    fule123

    Joined:
    Oct 30, 2020
    Posts:
    3
    thx