Search Unity

Question Why do my variables display as if there was no editor script on one component, but not on another?

Discussion in 'Editor & General Support' started by yellowyears, Oct 20, 2020.

  1. yellowyears

    yellowyears

    Joined:
    Feb 14, 2020
    Posts:
    36
    So I have a class, that has private serialized fields. And that has an editor script, which contains serialized properties and EditorGUILayout.PropertyFields to display those properties. upload_2020-10-20_15-46-51.png This is correct, and works how I want it.

    But then we go over to the other component, which has private serialized variables and an editor script. It displays like this: upload_2020-10-20_15-47-41.png

    Is there any way to solve this? I've been using [HideInInspector]. But the issue is that I use these variables both inside the editor class and the monobehaviour class. What would cause this?
     

    Attached Files:

  2. Vryken

    Vryken

    Joined:
    Jan 23, 2018
    Posts:
    2,106
    Solve what, exactly?
    What part of the second image isn't displaying correctly? How is it supposed to look? What does your custom inspector script look like?
     
    PraetorBlue likes this.
  3. yellowyears

    yellowyears

    Joined:
    Feb 14, 2020
    Posts:
    36
    Well you can see all of the variables, even though they are setup in the same way as the first one. They both just have serialized properties. But on the skeleton poser, there are no property fields. Could this be an issue? I feel it's messy to have the hide in inspector before everything. Should I be putting variables in the SkeletonPoser monobehaviour even if I only use them in the editor?
     
  4. Vryken

    Vryken

    Joined:
    Jan 23, 2018
    Posts:
    2,106
    The two images show two different scripts, so the inspector working as intended for the first script doesn't mean the inspector for the second script would also work as intended. You'd need to have two different custom inspectors for these two different scripts (which I'm assuming you already do).

    Which properties in the second script are supposed to be shown and which ones aren't supposed to be shown? We don't know how you want your inspector to look.