Search Unity

Variables and the Inspector

Discussion in 'Documentation' started by dbusby111, Dec 11, 2019.

  1. dbusby111

    dbusby111

    Joined:
    Nov 26, 2019
    Posts:
    3
    I came across an issue in the Unity Manual (https://docs.unity3d.com/Manual/VariablesAndTheInspector.html), where it states that variables must be declared public to see them in the Inspector. It should be pointed out that they must also start with a lowercase character, which is not in line with C# naming conventions. New users may get confused as to why they cannot see their variables in the Inspector if they are adhering to C# naming standards. I tried to use the Leave Feedback and Report an Issue link but they didn't work.
     
  2. karl_jones

    karl_jones

    Unity Technologies

    Joined:
    May 5, 2015
    Posts:
    3,626
    There is no restriction on the naming convention for serialized variables, it is fine for them to start with a capital letter.
     
  3. dbusby111

    dbusby111

    Joined:
    Nov 26, 2019
    Posts:
    3
    My apologies. Was this also the case in version 2017? I remember having to go through and rename several public variables to lowercase to show in the inspector.
     
  4. karl_jones

    karl_jones

    Unity Technologies

    Joined:
    May 5, 2015
    Posts:
    3,626
    Not that I'm aware of. Do you have an example?
     
unityunity