public SetPropertyVisitor(RuntimePrefabPropertyOverride <TOverrideValue> prefabOverride, string propertyPath,
                           SerializationMetadata metadata) : base(metadata)
 {
     m_PrefabOverride = prefabOverride;
     m_PropertyPath   = propertyPath;
     m_FirstProperty  = propertyPath.Split('.')[0];
 }
        public static void Update <TValue>(RuntimePrefabPropertyOverride @override, TValue value, SerializationMetadata metadata = null)
        {
            var propertyPath   = @override.m_PropertyPath;
            var transformPath  = @override.m_TransformPath;
            var componentIndex = @override.m_ComponentIndex;

            switch (value)
            {
            case Vector2 vector2:
            {
                var list = ((RuntimePrefabPropertyOverrideList)@override).List;
                list.Clear();
                list.Add(new RuntimePrefabOverrideFloat($"{propertyPath}.x", transformPath, componentIndex, vector2.x));
                list.Add(new RuntimePrefabOverrideFloat($"{propertyPath}.y", transformPath, componentIndex, vector2.y));
                break;
            }

            case Vector3 vector3:
            {
                var list = ((RuntimePrefabPropertyOverrideList)@override).List;
                list.Clear();
                list.Add(new RuntimePrefabOverrideFloat($"{propertyPath}.x", transformPath, componentIndex, vector3.x));
                list.Add(new RuntimePrefabOverrideFloat($"{propertyPath}.y", transformPath, componentIndex, vector3.y));
                list.Add(new RuntimePrefabOverrideFloat($"{propertyPath}.z", transformPath, componentIndex, vector3.z));
                break;
            }

            case Vector4 vector4:
            {
                var list = ((RuntimePrefabPropertyOverrideList)@override).List;
                list.Clear();
                list.Add(new RuntimePrefabOverrideFloat($"{propertyPath}.x", transformPath, componentIndex, vector4.x));
                list.Add(new RuntimePrefabOverrideFloat($"{propertyPath}.y", transformPath, componentIndex, vector4.y));
                list.Add(new RuntimePrefabOverrideFloat($"{propertyPath}.z", transformPath, componentIndex, vector4.z));
                list.Add(new RuntimePrefabOverrideFloat($"{propertyPath}.w", transformPath, componentIndex, vector4.w));
                break;
            }

            case Quaternion quaternion:
            {
                var list = ((RuntimePrefabPropertyOverrideList)@override).List;
                list.Clear();
                list.Add(new RuntimePrefabOverrideFloat($"{propertyPath}.x", transformPath, componentIndex, quaternion.x));
                list.Add(new RuntimePrefabOverrideFloat($"{propertyPath}.y", transformPath, componentIndex, quaternion.y));
                list.Add(new RuntimePrefabOverrideFloat($"{propertyPath}.z", transformPath, componentIndex, quaternion.z));
                list.Add(new RuntimePrefabOverrideFloat($"{propertyPath}.w", transformPath, componentIndex, quaternion.w));
                break;
            }

            case Color color:
            {
                var list = ((RuntimePrefabPropertyOverrideList)@override).List;
                list.Clear();
                list.Add(new RuntimePrefabOverrideFloat($"{propertyPath}.r", transformPath, componentIndex, color.r));
                list.Add(new RuntimePrefabOverrideFloat($"{propertyPath}.g", transformPath, componentIndex, color.g));
                list.Add(new RuntimePrefabOverrideFloat($"{propertyPath}.b", transformPath, componentIndex, color.b));
                list.Add(new RuntimePrefabOverrideFloat($"{propertyPath}.a", transformPath, componentIndex, color.a));
                break;
            }

            case Color32 color:
            {
                var list = ((RuntimePrefabPropertyOverrideList)@override).List;
                list.Clear();
                list.Add(new RuntimePrefabOverrideFloat($"{propertyPath}.r", transformPath, componentIndex, color.r));
                list.Add(new RuntimePrefabOverrideFloat($"{propertyPath}.g", transformPath, componentIndex, color.g));
                list.Add(new RuntimePrefabOverrideFloat($"{propertyPath}.b", transformPath, componentIndex, color.b));
                list.Add(new RuntimePrefabOverrideFloat($"{propertyPath}.a", transformPath, componentIndex, color.a));
                break;
            }

            case int @int:
            {
                ((RuntimePrefabOverrideInt)@override).Value = @int;
                break;
            }

            case long @long:
            {
                ((RuntimePrefabOverrideLong)@override).Value = @long;
                break;
            }

            case float @float:
            {
                ((RuntimePrefabOverrideFloat)@override).Value = @float;
                break;
            }

            case UnityObject unityObject:
            {
                ((RuntimePrefabOverrideUnityObjectReference)@override).Value = UnityObjectReference.GetReferenceForObject(unityObject, metadata);
                break;
            }

            default:
            {
                // TODO: Handle null values better
                if (typeof(TValue) == typeof(UnityObject) && value == null)
                {
                    ((RuntimePrefabOverrideUnityObjectReference)@override).Value = UnityObjectReference.NullObjectReference;
                    break;
                }

                ((RuntimePrefabPropertyOverride <TValue>)@override).Value = value;
                break;
            }
            }
        }