Search Unity

Scriptable object inspector won't show up if function has default parameter assigned

Discussion in 'Scripting' started by Hellwaiker, Jul 3, 2019.

  1. Hellwaiker

    Hellwaiker

    Joined:
    Jan 8, 2016
    Posts:
    118
    Hi,

    I ran into a weird problem. So the setup I have is.
    Code (CSharp):
    1. [System.Serializable]
    2. public class SomeClass
    3. {
    4.    public void SomeFunction(String bla, SomeOtherScript SomeOtherScriptObject = null)
    5.   {
    6.  
    7.   }
    8. }
    9.  
    10. public class ScriptableObjectClass: ScriptableObject
    11. {
    12.   public SomeClass SomeClassObject;
    13. }
    So whenever I assign something to SomeOtherScriptObject = null the inspector of ScriptableObject asset will show completely blank and I can't assign that ScriptableObject assets to any of the scripts variable fields. if I delete = null part everything works. Is this a bug or I'm not supposed to init variables defaults?

    Unity version is 2017.4.24.f1
     
  2. palex-nx

    palex-nx

    Joined:
    Jul 23, 2018
    Posts:
    1,748
    Have you tested it in empty project? Im using scriptables and default parameter values and didn't noticed anything like this.
     
  3. Hellwaiker

    Hellwaiker

    Joined:
    Jan 8, 2016
    Posts:
    118
    No not yet, I'll try in empty.