Hi there,
I am using Unity’s GraphView to create a node editor and I was wondering if there is C# API to let me programatically “look” at a certain node.
Ideally, I would want GraphView to keep focus on place where the nodes are converged in general.
Many thanks!
Found the solution. It’s referred to as “framing” elements (docs).
You can frame to selection, frame to fit all elements, and frame to origin (which is what’s happening by default I believe).
If you want to frame elements during the same call as when you added said elements, you should use scheduler (docs):
public void PopulateNodes()
{
// populate nodes here
// ...
schedule.Execute(() =>
{
FrameAll();
});
}