public static TElement Construct <TProperty, TElement, TFieldType, TContainer, TValue>( TProperty property, ref TContainer container, ref TValue value, InspectorContext context ) where TProperty : IProperty <TContainer, TValue> where TElement : BaseField <TFieldType>, new() where TValue : struct { var element = ConstructBase <TProperty, TContainer, TElement, TFieldType, TValue>(property); if (TranslatorFactory <TValue> .TryGetUpdater(element, out var t)) { var offset = context.GetOffsetOfField(property.GetName()); var index = context.GetCurrentIndex(); var setter = context.DataProvider; t.SetUpdaters(element, setter, offset, index); } else { UnityEngine.Debug.Log($"No data translator registered between {typeof(TValue).Name} and {typeof(TFieldType).Name}"); } if (context.GetParent(out var parent)) { parent.contentContainer.Add(element); } if (property.IsContainer) { context.PushParent(element); } return(element); }
private void GetUpdater <TValue>(VisualElement element) where TValue : struct { if (TranslatorFactory <TValue> .TryGetUpdater(element, out var updater)) { updater.SetUpdaters(element, m_Root, m_Offset, m_Root is StructDataElement <TData, TValue> buffer ? buffer.Index : -1); } }