Now I have these:
public struct lint
{
private long value;
private lint(int value)
{
this.value = value;
}
private lint(long value)
{
this.value = value;
}
public static implicit operator lint(int value)
{
return new lint(value);
}
public static implicit operator lint(long value)
{
return new lint(value);
}
public static implicit operator int(lint record)
{
return (int)record.value;
}
public static implicit operator long(lint record)
{
return record.value;
}
public override string ToString()
{
return value.ToString();
}
}
And There is a test class:
[System.Serializable]
private class TestS
{
public lint zip;
}
How can I make the lint work like a long or int?
TestS s = new TestS();
s.zip = 3;
Debug.Log(JsonUtility.ToJson(s));
This comes out {“zip”:{}},but I want {“zip”:3}