Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

ScriptableRenderererFeature "settings" object required?

Discussion in 'Universal Render Pipeline' started by Meatloaf4, May 6, 2021.

  1. Meatloaf4

    Meatloaf4

    Joined:
    Jul 30, 2013
    Posts:
    183
    I have viewed several examples / tutorials that state that it's necessary to create a field with the name "settings" in order to display ScriptableRendererFeature fields in the inspector. From my testing though it looks like I can just create public fields like usual and they will show up in the inspector.

    There are several examples where this is true but here is one I can point to, to give a bit more context.
    https://samdriver.xyz/article/scriptable-render. See attached image for more info.

    Code (CSharp):
    1. public class MyBlitFeature : ScriptableRendererFeature
    2. {
    3.   [System.Serializable]
    4.   public class MyFeatureSettings
    5.   {
    6.     // we're free to put whatever we want here, public fields will be exposed in the inspector
    7.     public bool IsEnabled = true;
    8.     public RenderPassEvent WhenToInsert = RenderPassEvent.AfterRendering;
    9.     public Material MaterialToBlit;
    10.   }
    11.  
    12.   // MUST be named "settings" (lowercase) to be shown in the Render Features inspector
    13.   public MyFeatureSettings settings = new MyFeatureSettings();
    14. ...
    The above an example of the code in question from the tutorial I was following. Hopefully this makes sense.

    Is the settings object / field still necessary? Is there something I'm missing? Can I just use normal fields instead of a settings object without issue?

    Thanks for any help in advance!
     

    Attached Files: