public virtual void UpdateValue()
        {
            var value = IValue.Value;

            // if the type has changed fundamentally, make a new interactivevalue for it
            var type = value == null
                ? FallbackType
                : value.GetType();

            var ivalueType = InteractiveValue.GetIValueForType(type);

            if (ivalueType != IValue?.GetType())
            {
                IValue.OnDestroy();
                CreateIValue(value, FallbackType);
                m_subContent?.SetActive(false);
            }

            IValue.OnValueUpdated();
        }
Example #2
0
        public override void OnValueUpdated()
        {
            base.OnValueUpdated();

            if (UnderlyingValue == null && SubIValue != null)
            {
                SubIValue = null;
            }
            else if (UnderlyingValue != null && SubIValue == null)
            {
                SubIValue       = Create(UnderlyingValue, ElementType);
                SubIValue.Owner = this.Owner;
                SubIValue.m_mainContentParent = this.m_mainContentParent;
                SubIValue.m_subContentParent  = this.m_subContentParent;
                SubIValue.ConstructUI(m_valueContent, m_uiSubGroupParent);
                m_createDestroyBtn.transform.SetAsLastSibling();
            }

            SubIValue?.OnValueUpdated();
            RefreshUIForValue();
        }