using UnityEngine; using UnityEngine.UIElements; namespace UnityEditor.VFX.UI { abstract class VFXVectorNField : VFXControl { FloatField[] m_Fields; protected abstract int componentCount { get; } private string GetComponentName(int i) { switch (i) { case 0: return "x"; case 1: return "y"; case 2: return "z"; case 3: return "w"; default: return "a"; } } public override void SetEnabled(bool v) { for (int i = 0; i < componentCount; ++i) { m_Fields[i].SetEnabled(v); } } void CreateTextField() { m_Fields = new FloatField[componentCount]; for (int i = 0; i < m_Fields.Length; ++i) { var newField = new FloatField(GetComponentName(i)); m_Fields[i] = newField; m_Fields[i].AddToClassList("fieldContainer"); m_Fields[i].RegisterCallback, int>(OnValueChanged, i); m_Fields[i].RegisterCallback(OnLostFocus); var label = newField.Q