I'm trying to show count from a parse class into label but the following error is occurring:
"CompareBaseObjectsInternal can only be called from the main thread. Constructors and field initializers will be executed from the loading thread when loading a scene. Don't use this function in the constructor or field initializers, instead move initialization code to the Awake or Start function."
My code is given below. Can anyone help me?
ParseQuery<ParseObject> USQuery = ParseObject.GetQuery ("Sales")
.WhereEqualTo ("transactionType", "Purchase")
.WhereGreaterThan ("createdAt",DateTime.Now.AddDays(-1));
USQuery.CountAsync().ContinueWith(t =>
{
int result=t.Result;
labelUSSale.text=result.ToString();
});