C#C
C#3y ago
Nukadelic

❔ Is it possible to define a struct inline ?

instead of doing this
    [System.Serializable]
    public struct Properties
    {
        public float clipDistance;
        public float clipHeight;
        public float scale;
        public float3 rotation;
        public float rotationSpeed;
        public float floatDistance;
        public float floatSpeed;
    }

    public Properties properties = new Properties
    {
        clipDistance = 100,
        clipHeight = 10,
        scale = 0.4f,
        rotation = new float3(90, 0, 0),
        rotationSpeed = 1,
        floatDistance = 0.2f,
        floatSpeed = 0.2f,
    };

i want something like this :
public properties = new [System.Serializable] public struct Properties
{
        public float clipDistance = 100,
        public float clipHeight = 10,
        public float scale = 0.4f,
        public float3 rotation = new float3(90, 0, 0),
        public float rotationSpeed = 1,
        public float floatDistance = 0.2f,
        public float floatSpeed = 0.2f,
};
Was this page helpful?