[Serializable, JsonObject(MemberSerialization.OptIn)]
public class JsonData
{
[JsonProperty("id")] public string id;
[JsonProperty("data")] public Data data;
[JsonProperty("extra_data") public int extraData;
}
public class JsonVariantContractResolver : DefaultContractResolver
{
protected override IList<JsonProperty> CreateProperties(Type type, MemberSerialization memberSerialization)
{
IList<JsonProperty> list = base.CreateProperties(type, memberSerialization);
for (var i = 0; i < list.Count; i++)
{
list[i].ShouldSerialize = OnShouldSerialize;
}
return list;
}
private bool OnShouldSerialize(object value)
{
Debug.Log(value);
return true;
}
}
private void Update()
{
var token = new CancellationTokenSource();
}
private void Update()
{
var token = new CancellationTokenSource();
}
var uniTask = Func?.Invoke(_tokenSource.Token);
await uniTask.GetValueOrDefault();