the issue is fields are not serialized by default. you need to configure:
builder.Services.AddControllers().AddJsonOptions(o => o.JsonSerializerOptions.IncludeFields = true);
But I'd recommend not doing this. You should create a simple object to return:
public class Vector3Model
{
public float X { get; set; }
public float Y { get; set; }
public float Z { get; set; }
public Vector3Model() {}
public Vector3Model(Vector3 v)
{
X = v.X;
Y = v.Y;
Z = v.Z;
}
public Vector3 ToVector3()
{
return new Vector3(X, Y, Z);
}
}
then its:
return new Vector3Model(Vector3.One);
note: by default swagger also does not include fields in the schema, you will need to define the schema to use fields