MephestoKhaan / UnityEventVisualizer

A graph editor for viewing all UnityEvents at a glance
MIT License
589 stars 48 forks source link

Local graphs backtrack #16

Open MephestoKhaan opened 4 years ago

MephestoKhaan commented 4 years ago

Allow localgraphs to not only show events leaving the target, but arriving to it.

thestonefox commented 4 years ago

Is this the concept of you can select a GameObject in the Unity hierarchy and for a component on there it will show what events are calling methods on that component?

I (think) it's not possible to start from that component and go upstream via code, but if you have a map of the downstream already then you can use that map to do that upstream lookup.

if this issue is related to the feature I outlined then that would be so useful! Because there's no real way of doing this in the Unity inspector.

You can start at a component and keep clicking on the event listeners to follow the flow downstream but you can't start on a component and see what event listeners are calling methods on that component.

MephestoKhaan commented 4 years ago

Correct! going upstream is the goal here. I do have the map, huge on VRTK for example but the "price" comes from painting it entirely really. So it should be achievable to do a search on what nodes are calling the selected GO.

thestonefox commented 4 years ago

That would be so useful for VRTK. The amount of times i know where I end up but I wanna see how I got there

MephestoKhaan commented 4 years ago

Some progress!! https://gyazo.com/bf171458811555edb0935184c314874e

So, searching all events in the scene (28k events) take like 30 seconds, but you really need to do that "once" unless you change the hierarchy.

Then showing ALL events is pretty much impossible (and unusable) but searching in the cached set for the ones around (sending or receiving calls) is very fast. So you can traverse the tree up and down.

I will make it a bit more usable (adding the new boxes but not removing the old ones so it keeps thing in place) plus adding some more interesting menus and hopefully upload it next week or so

Not how the "random" colours of the edges kept unaltered

MephestoKhaan commented 4 years ago

Thinking about how to do this, probably the buttons will change to:

"Cache all events" <== mark as dirty when hierarchy changes, add a loader "Refresh" <=== updates for when changing maybe links but not necesarily the hierarchy (or play/stop) "Add self" <=== adds all events coming and going from the selected GO "Add hierarchy" <==== same as above but for the whole hierarchy (really needed?) "Remove node" <==== removes them from the graph

thestonefox commented 4 years ago

Being able to jump back up through the possible events that called your method will be so useful for vrtk debugging!