/// <summary>
    /// Refresh the Area Description list's UI content.
    ///
    /// This function updates the list's UI based on local Area Descriptions. It also hooks up a callback to each
    /// element to get notified when the selected Area Description changes.
    /// </summary>
    private void _PopulateList()
    {
        foreach (Transform t in m_listContentParent.transform)
        {
            Destroy(t.gameObject);
        }

#if UNITY_EDITOR
        AreaDescription.GenerateEmulatedSavePath();
#endif
        AreaDescription[] areaDescriptionList = AreaDescription.GetList();

        if (areaDescriptionList == null)
        {
            return;
        }

        foreach (AreaDescription areaDescription in areaDescriptionList)
        {
            GameObject newElement = Instantiate <GameObject>(m_listElement);
            AreaDescriptionListElement listElement = newElement.GetComponent <AreaDescriptionListElement>();
            listElement.m_toggle.group             = m_toggleGroup;
            listElement.m_areaDescriptionName.text = areaDescription.GetMetadata().m_name;
            listElement.m_areaDescriptionUUID.text = areaDescription.m_uuid;

            // Ensure the lambda makes a copy of areaDescription.
            AreaDescription lambdaParam = areaDescription;
            listElement.m_toggle.onValueChanged.AddListener((value) => _OnToggleChanged(lambdaParam, value));
            newElement.transform.SetParent(m_listContentParent.transform, false);
        }
    }
Beispiel #2
0
    /// <summary>
    /// Use this for initialization.
    /// </summary>
    public void Start()
    {
#if UNITY_EDITOR
        // We must initialize this on the main Unity thread, since the value
        // is sometimes used within a separate saving thread.
        AreaDescription.GenerateEmulatedSavePath();
#endif

        m_tangoApplication = FindObjectOfType <TangoApplication>();

        if (m_tangoApplication != null)
        {
            m_tangoApplication.Register(this);

            if (AndroidHelper.IsTangoCorePresent())
            {
                m_tangoApplication.RequestPermissions();
            }
        }
        else
        {
            Debug.Log("No Tango Manager found in scene.");
        }
    }