public async void LoadExistingFeedbackAsync() // todo: clean up mess { List <FeedbackData> existingFeedback = await firebaseHandler.GetFeedbackData(anchorObject.name); // foreach (var x in existingFeedback) //for (int i = 0; i < existingFeedback.Count; i++) int loadLimit = 5; // hard coded... maybe put up at the top for (int i = 0; i < Mathf.Min(loadLimit, existingFeedback.Count); i++) { //PlaceFeedback(x.text, x.author, x.position + anchorObject.transform.position, x.rotation * anchorObject.transform.rotation, false); // dont place loaded notes in saved position, instead place them organized next to poster // create note object GameObject newNote = Instantiate(notePrefab, anchorObject.transform.position, anchorObject.transform.rotation) as GameObject; newNote.transform.parent = anchorObject.transform; newNote.name = "note"; // neat feedback positioning (some hard coded values...) newNote.transform.localPosition += new Vector3(-.15f, 0, -.03f + .12f * i); // set text of note TMP_Text[] newNoteText = newNote.GetComponentsInChildren <TMP_Text>(); newNoteText[0].text = existingFeedback[existingFeedback.Count - 1 - i].text; newNoteText[1].text = "- " + existingFeedback[existingFeedback.Count - 1 - i].author; // set note wobble behavior newNote.GetComponent <NoteSpawnBehavior>().pauseBeforeWobble = i / 3f; } caliperEventHandler.FeedbackLoaded(existingFeedback.Count, anchorObject.name, anchorObject.GetInstanceID().ToString(), "Feedback data for the " + anchorObject.name + " poster was loaded into the app."); }