void RemoveComponent()
        {
            m_Container.RemoveComponent <T>();
            if (m_Container.HasComponent <T>())
            {
                m_Element?.SetTarget(m_Container.GetComponent <T>());
                SetBorderColor();
            }
            else
            {
                RemoveFromHierarchy();
            }

            OnChanged();
        }
示例#2
0
 public void Update()
 {
     if (m_Container.HasComponent <T>() || m_IsOptional)
     {
         m_Element.style.display = DisplayStyle.Flex;
         m_MissingComponentLabel.style.display = DisplayStyle.None;
         m_Element.SetTarget(m_Container.GetComponentOrDefault <T>());
     }
     else
     {
         m_Element.style.display = DisplayStyle.None;
         m_MissingComponentLabel.style.display = DisplayStyle.Flex;
     }
 }