private void SetupTemplate()
        {
            //IL_0164: Unknown result type (might be due to invalid IL or missing references)
            //IL_016e: Expected O, but got Unknown
            validTemplate = false;
            if (!Object.op_Implicit(m_Template))
            {
                Debug.LogError((object)"The dropdown template is not assigned. The template needs to be assigned and must have a child GameObject with a Toggle component serving as the item.", this);
                return;
            }
            GameObject gameObject = m_Template.get_gameObject();

            gameObject.SetActive(true);
            Toggle componentInChildren = m_Template.GetComponentInChildren <Toggle>();

            validTemplate = true;
            if (!Object.op_Implicit(componentInChildren) || componentInChildren.get_transform() == template)
            {
                validTemplate = false;
                Debug.LogError((object)"The dropdown template is not valid. The template must have a child GameObject with a Toggle component serving as the item.", template);
            }
            else if (!(componentInChildren.get_transform().get_parent() is RectTransform))
            {
                validTemplate = false;
                Debug.LogError((object)"The dropdown template is not valid. The child GameObject with a Toggle component (the item) must have a RectTransform on its parent.", template);
            }
            else if (itemText != null && !itemText.get_transform().IsChildOf(componentInChildren.get_transform()))
            {
                validTemplate = false;
                Debug.LogError((object)"The dropdown template is not valid. The Item Text must be on the item GameObject or children of it.", template);
            }
            else if (itemImage != null && !itemImage.get_transform().IsChildOf(componentInChildren.get_transform()))
            {
                validTemplate = false;
                Debug.LogError((object)"The dropdown template is not valid. The Item Image must be on the item GameObject or children of it.", template);
            }
            if (!validTemplate)
            {
                gameObject.SetActive(false);
                return;
            }
            DropdownItem dropdownItem = componentInChildren.get_gameObject().AddComponent <DropdownItem>();

            dropdownItem.text          = m_ItemText;
            dropdownItem.image         = m_ItemImage;
            dropdownItem.toggle        = componentInChildren;
            dropdownItem.rectTransform = componentInChildren.get_transform();
            Canvas orAddComponent = TextFieldDropdown.GetOrAddComponent <Canvas>(gameObject);

            orAddComponent.set_overrideSorting(true);
            orAddComponent.set_sortingOrder(30000);
            TextFieldDropdown.GetOrAddComponent <CustomGraphicRaycaster>(gameObject);
            TextFieldDropdown.GetOrAddComponent <CanvasGroup>(gameObject);
            gameObject.SetActive(false);
            validTemplate = true;
        }