IEnumerator GetUserName(){ // userIdで名前を引いて ParseQuery<ParseObject> query = ParseObject.GetQuery(ParseTableName.NameTable); query = query.WhereEqualTo (ParseColumnName.userUniqueId, userId); var queryTask = query.FirstAsync(); while (!queryTask.IsCompleted) yield return null; ParseObject obj = queryTask.Result; if(queryTask.IsFaulted){ userName.text = "anonymouse"; } else{ userName.text = obj.Get<string>("userName"); } yield return null; }
コルーチン風に書いて回避できた。参考 https://www.parse.com/questions/unity-error-constructors-and-field-initializers-will-be-executed-from-the-loading-thread-when-loading-a-scene