- Home /
Child Class not showing in inspector
I am working on a texture matrix with multiple input texture Materials, although the child class is showing up as empty Elements in the inspector
[System.Serializable]
public class textureMaterial
{
public Material textureMat;
public float textureUnit;
public textureMatrix[] texMatrix;
[System.Serializable]
public class textureMatrix
{
public string tMapName { get; set; }
public Vector2 tMapVector { get; set; }
}
}
public textureMaterial[] texMat;
Answer by christophfranke123 · Oct 28, 2014 at 10:15 AM
You have to remove the { get; set; }
in your code, so your class looks like
public class textureMatrix
{
public string tMapName;
public Vector2 tMapVector;
}
The { get; set; }
syntax lets the compiler create a private variable and a public get and set function for it (see what is the get set syntax).
Functions are never shown by the inspector. Private variables are only shown, if you specify the [SerializeField] property, which is not possible in this case, because the private var is automatically created by the compiler.
Your answer
Follow this Question
Related Questions
Multiple Cars not working 1 Answer
Distribute terrain in zones 3 Answers
Public Variables not displaying in the inspector 0 Answers
How to make public variable read-only during run-time? 3 Answers