Exemple #1
0
    // Coroutine to save the user's position to Firebase
    IEnumerator _SendData()
    {
        while (true)
        {
            // The ID that identifies the person in the room.
            string id = SystemInfo.deviceUniqueIdentifier;

            // Get the position of the current camera.
            PersonData cd  = PersonData.CreatePersonData(Camera.main.transform, deviceLocationId);
            string     scd = JsonUtility.ToJson(cd);

            // Save to Firebase
            peopleRef.Child(cd.id).SetRawJsonValueAsync(scd);

            // Wait some time before sending again
            yield return(new WaitForSeconds(updateInterval));
        }
    }