Modifying ExposedProperties doesn't trigger EndChangeCheck in custom editor windows

Greetings!

I was hesitant to call this a bug as it maybe by design, but for backwards compatibility I think it qualifies.

The issue is I have a custom editor window. It reads prefabs and displays editors for specific components at specific times. So far this has worked for every other Unity I've needed to use within a custom editor. Except for the VisualEffect component.

This is the basic mechanism to check for changes within the editor window. It works for ParticleSystem, Transforms, etc, but not for the VisualEffect component.

EditorGUI.BeginChangeCheck();
visualEffectEditors[index].OnInspectorGUI();
if (EditorGUI.EndChangeCheck())

I did, however, fix it locally on my end. This is a section of code from Editor/Inspector/VisualEffectEditor.cs source, modified to set GUI.changed = true if modifications were made:

This is the very end of the OnInspectorGUI function:

/// 2022-06-05 - Will
/// Added change flag to capture modified parameters
bool changed = false;
if (!m_VisualEffectAsset.hasMultipleDifferentValues)
{
    if (showGeneralCategory)
        InitialEventField(resource);

    DrawRendererProperties();
    /// 2022-06-05 - Will Poillion
    /// Modified DrawParameters to return a bool if a parameter was modified.
    changed = DrawParameters(resource);
}
EditorGUI.indentLevel = 0;
if (serializedObject.ApplyModifiedProperties())
{
    var window = EditorWindow.GetWindow<VFXViewWindow>();
    if (window != null)
        window.OnVisualEffectComponentChanged(targets.Cast<VisualEffect>());
}
/// 2022-06-05 - Will 
/// If changed, then set GUI.changed = true to trigger EndChangeCheck
if (changed)
    GUI.changed = true;

And in order for the DrawParameters to returned whether a parameter has been changed or not, this is added to the top of the DrawParameters function:

/// Added changed bool
bool changed = false;

And then at the end set the changed flag if properties were modified:

                            /// 2022-06-05 - Will 
                            /// If any property modified, then set changed flage
                            if (m_SingleSerializedObject.ApplyModifiedProperties())
                            {
                                changed = true;
                                GUI.changed = true;
                            }
                        }
                    }
                }
            }
        }
    }
    GUILayout.Space(1); // Space for the line if the last category is closed.

    /// 2022-06-05 - Will 
    /// Return changed flag
    return changed;
}

I was hesitant to call it a bug as I imagine this means of detecting editor changes might be falling out of favor and on the road to being deprecated. However, in the meantime this is the means I'm aware of to detect changes to the exposed properties.

I'm using the latest 12.1.7 version of VFX graph on Unity 2021.3.9f1. I'm attaching the entire VisualEffectEditor.cs to get the fully customized file.

Again, let me know if there's a more accepted way of doing this. Or if this is truly a bug, then I'm glad I labeled it as such!

Thanks!
Will

8432228--1116650--VisualEffectEditor.cs (71.5 KB)

1 Like

Bump. Just hoping to get an acknowledgement from Unity that they're actually aware of this issue. Or at minimum that they even consider it an issue.

Hi,
Thanks for pointing this to our attention and for the proposed fix!
I created a ticket on our side to not forget about it and keep track of the progress.

Thanks!

1 Like

[quote=“Julien-A”, post:3, topic: 893961]
Hi,
Thanks for pointing this to our attention and for the proposed fix!
I created a ticket on our side to not forget about it and keep track of the progress.

Thanks!
[/quote]

Thank you Julien for the response!

I apologize if this is a noob question, but is there a publicly accessible location to watch tickets like that? It’s no problem if there isn’t, I was just wondering. I imagine that would be a very difficult logistical challenge.

But aside from that, is there is a way to watch for things like this? Or is the main mechanic simply to watch for newest releases of VisualEffect component and check for fixes at that time? Is there a way to get notifications on updates for specific components? Like, get an email when the VisualEffect component releases a new version?

This is very low priority and I apologize for the noob questions. I am really just curious how other developers watch or keep track of bugs they’ve reported. I’ve honestly never had to do it before.

Thanks again Julien I appreciate your response!
Will

Hi,
Yes, you can track the progress of the logged ticket here.
Sorry for not posting the link before.

1 Like

Hi @lorewap3 ,
It took a bit of time but the fix you requested will be available starting with 2023.2-0a1.
The fix is a bit different to what you suggested but it should work as expected.