Variables not showing up in inspector

Javascript code:

class spriteDetails
{
var pixelWidth: int;
var pixelHeight: int;
}
var singleSpriteDimensions: spriteDetails;

This gives me the pixelWidth and -Height variables in the inspector (as part of ‘Single Sprite Dimensions’)

Equivalent (at least I thought so) C# code:

public class SpriteManager : MonoBehaviour {
 public class spriteDetails {
     public int pixelWidth;
     public int pixelHeight;
     }
    public spriteDetails singleSpriteDimensions = new spriteDetails();
}

However no variables show up in the inspector if I use the C# script. Any ideas why?

That’s a thing where UnityScript is misleading. You need to mark custom classes as Serializable. In UnityScript every class gets this attribute by default. In C# you have to add it:

[System.Serializable]
public class spriteDetails
{
    public int pixelWidth;
    public int pixelHeight;
}