Custom class not displayed in the inspector (Serializable)

Hi,

I’m using two customs classes that I want to be displayed in the inspector. I followed a lot of tutorial but it is not working. This tuts from Unity3D (Unity - Manual: Property Drawers) is not working, the examples are wrong. (I’m still not at the propertyDrawers part because I can’t manage to display values in the inspector.)

Here are my customs classes:

using UnityEngine;
using System;

[Serializable]
public class Season {
	ESeasons season; //Enum
	Weather[] weathersProb = new Weather[4];
}

[Serializable]
public class Weather {
	EWeather weather; //Enum
	int probability;
}

I think it is simple to understand, is for my configuration file/script where I initialized the seasons like this:

[Header("Seasons and weather settings")]
public Season[] seasons;

Here is the result in the inspector:
51656-unityinspector.png

What I want is something like this:
Seasons
Size 4
WINTER
RAIN 50
SUN 30
SPRING
RAIN 70
SUN 30

Where am I wrong ? Thanks for your help !

The examples were indeed translated into C# incorrectly; fields are private/nonserialized by default, unlike in Unityscript, where they are.

The solution is to make the fields of the Serializable classes public, or mark them with [SerializeField] if you’d prefer they not be public.