Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
Tags

Snapshot Shaders Pro for Unity

A collection of 34 image effects for Unity URP, HDRP, and Built-in · By Daniel Ilett

[Unity 2022.A.10f1] [Errors] return type must be 'GUIContent' to match overridden member

A topic by MlleDR created Nov 02, 2022 Views: 224 Replies: 4
Viewing posts 1 to 5
(1 edit)

Hello,

I've imported the Snapshot Shaders Pro (URP) 1.5 in my project and I'm having all kind of errors like the following:

Assets\Snapshot Pro URP\Editor\RadialBlurEditor.cs(54,28): error CS0508: 'RadialBlurEditor.GetDisplayTitle()': return type must be 'GUIContent' to match overridden member 'VolumeComponentEditor.GetDisplayTitle()'

Assets\Snapshot Pro URP\Editor\FancyOutlineEditor.cs(75,28): error CS0508: 'FancyOutlineEditor.GetDisplayTitle()': return type must be 'GUIContent' to match overridden member 'VolumeComponentEditor.GetDisplayTitle()'

Assets\Snapshot Pro URP\Editor\GreyscaleEditor.cs(51,28): error CS0508: 'GreyscaleEditor.GetDisplayTitle()': return type must be 'GUIContent' to match overridden member 'VolumeComponentEditor.GetDisplayTitle()'

Errors are for all Renderer features editors like:

  • RadialBlurEditor.GetDisplayTitle()
  • FancyOutlineEditor.GetDisplayTitle()
  • GreyscaleEditor.GetDisplayTitle()
  • ect...

Do you know how to fix this?

Thanks

Developer

I suspect this is a change that Unity has made in Unity 2022 regarding the return type of a function I'm overriding in my own code, given the errors you're getting. I will look into this!

Thanks Daniel!

Hey! Any idea when this will be fixed? Or is there something I can do to get it working until the next update? Just upgraded my project and this is giving me a few errors.  Thanks for making this package, I love it!

Developer

I've had a look at this, and thankfully it's an easy fix, but it does have to be applied to each Editor script. Unity changed the return type of the GetDisplayTitle method in Unity 2021.2 - the fix I'll be implementing is wrapping the method in a conditional like this:

#if UNITY_2021_2_OR_NEWER
    public override GUIContent GetDisplayTitle()
    {
        return new GUIContent("Name of the effect goes here");
    }
#else
    public override string GetDisplayTitle()
    {
        return "Name of the effect goes here";
    }
#endif

You'll also need to import the UnityEngine namespace, which your IDE will likely tell you to do. Hope that helps - let me know if there are still issues with any of the scripts!