Jump to content

CS0115 no suitable method found to override material editors


DoomTube275

Recommended Posts

I imported Gaia Pro 2021 into my project and am getting these errors and have no clue how to fix them. 

Assets\Procedural Worlds\Gaia\Scripts\Water System\Editor\PW_WaterUnder_MaterialEditor.cs(19,23): error CS0115: 'PW_WaterUnderMaterialEditor.OnGUI(MaterialEditor, MaterialProperty[])': no suitable method found to override

Assets\Procedural Worlds\Gaia\Shaders\Scripts\Editor\PW_General_MaterialEditor.cs(585,23): error CS0115: 'PW_General_MaterialEditor.OnGUI(MaterialEditor, MaterialProperty[])': no suitable method found to override

Assets\Procedural Worlds\Gaia\Scripts\Water System\Editor\PW_Water_MaterialEditor.cs(372,23): error CS0115: 'PW_Water_MaterialEditor.OnGUI(MaterialEditor, MaterialProperty[])': no suitable method found to override

Link to comment
Share on other sites

Hi @DoomTube275, this is an odd one: Gaia includes a few shaders that have a custom material editor - this means that we customized the UI that you see in the inspector when you e.g. select the water material:

image.png

To do so, we need to derive from the ShaderGUI class (which is a part of unity) and override the "OnGUI" function. The error message translates to: "Hey, there is no OnGUI function to override in the ShaderGUI class!" 
I assume what might cause this is if another asset or one of your own scripts also defined a class called "ShaderGUI". This then creates a problem because the compiler thinks our scripts are referring to that other definition of "ShaderGUI" and not the one that is part of Unity.

Can you please open the file
Assets\Procedural Worlds\Gaia\Shaders\Scripts\Editor\PW_General_MaterialEditor.cs
and hover your mouse cursor over the term "ShaderGUI"? It should show you to which definition it links to, correct would be "UnityEditor.ShaderGUI"

image.png

I assume in your case it is pointing to something else instead. There are two ways to fix this then:

1. Right click on "ShaderGUI" and select "Go to definition". Try to find out where that other definition of ShaderGUI comes from and ask the other developer to include it into its own namespace - defining classes that share a name with a class from the UnityAPI is problematic as it leads to issues like yours.

2. If that does not work / developer does not respond, you can go to all usages of "ShaderGUI" in the Gaia code (double clicking the error in the console should take you there) and replace ShaderGUI with "UnityEditor.ShaderGUI" to make it clear that this should link to the UnityEditor class and not a different one:
image.png

If you save that file then, the error should be gone for that file.

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Tell a friend

    Love Canopy - Procedural Worlds? Tell a friend!
  • Need help?

    We work with some of the biggest brands in global gaming, automotive, technology, and government to create environments, games, simulations, and product launches for desktop, mobile, and VR.

    Our unique expertise and technology enable us to deliver solutions that look and run better at a fraction of the time and cost of a typical project.

    Check out some of our non-NDA work in the Gallery, and then Contact Us to accelerate your next project!

×
×
  • Create New...