Documentation

Unity Engine

Download Unity

Unity Engine

GraphView

Main GraphView class.
Read time 11 minutesLast updated a month ago

Definition

public abstract class GraphView : VisualElement, IEventHandler, IResolvedStyle, ITransform, ITransitionAnimations, IExperimentalFeatures, IVisualElementScheduler, ICustomStyle, ISelection

Fields

Value

Description

portsAll ports currently in the graph.

Properties

Property

Description

canPasteSerializedDataAsk whether or not the serialized data can be pasted.
contentViewContainerMain content container.
deleteSelectionDelete selection callback.
edgesAll edges in the graph.
elementResizedElement resized callback.
elementsAddedToGroupCallback for when GraphElements are added to the group.
elementsInsertedToStackNodeCallback for when GraphElements are inserted into a StackNode.
elementsRemovedFromGroupCallback for when GraphElements are removed from the group.
elementsRemovedFromStackNodeCallback for when GraphElements are removed from a StackNode.
graphElementsAll GraphElements in the graph.
graphViewChangedCallback for when certain changes have occured in the graph. See GraphViewChange.
groupTitleChangedCallback for when a group title is changed.
isReframableWhether or not the selection is reframable.
maxScaleMax zoom level.
minScaleMin zoom level.
nodeCreationRequestCallback for when the user requests to display the node creation window.
nodesAll nodes currently in the graph.
placematContainerThe PlacematContainer used by the GraphView.
referenceScaleReference zoom level.
scaleCurrent graph zoom level.
scaleStepZoom step. See ContentZoomer.scaleStep for details.
selectionAll currently selected elements in the graph.
serializeGraphElementsCallback for serializing graph elements for copy/paste and other actions.
supportsWindowedBlackboardSet to true when this GraphView supports windowed Blackboards. Set to false otherwise.
unserializeAndPasteCallback for unserializing graph elements and adding them to the graph.
viewportThe graph's viewport. This is currently just itself.
viewTransformGraph's view transform.
viewTransformChangedView transform changed callback.
zoomerMaxElementCountWithPixelCacheRegenNumber of elements in the graph above which the zoom manipulator will turn off pixel cache regeneration on each tick to avoid performance drops.

Methods

Method

Description

AddElementAdd new GraphElement. Should use this instead of Add() for adding GraphElements.
AddLayerAdds a new layer to the GraphView.
AddToSelectionAdd element to selection.
BuildContextualMenuAdd menu items to the contextual menu.
CalculateRectToFitAllCalculate the rectangle size and position to fit all elements in graph.
CanPasteSerializedDataDefault method for checking if serialized data can be pasted.
ClearSelectionClear selection.
CreatePlacematContainerOverride this method, in a derived class, to create a custom PlacematContainer.
DeleteElementsRemove elements from the graph view.
DeleteSelectionDelete selected elements.
DeleteSelectionOperationDefault method for deleting selection.
FrameAllFocus view all elements in the graph.
FrameNextFocus view on the next element after the one currently selected.
FrameOriginFocus view on the graph's origin.
FramePrevFocus view on the previous element before the one currently selected.
FrameSelectionFocus view on currently selected elements.
GetBlackboardGets the blackboard associated with this GraphView.
GetCompatiblePortsGet all ports compatible with given port.
GetEdgeByGuidGet edge by its GUID.
GetElementByGuidGet any element with a given GUID.
GetNodeByGuidGet node with a given GUID.
GetPortByGuidGet port by its GUID.
GetPortCenterOverrideGets another location for a specific port and checks if the port has an overridden position.
HandleEventBubbleUpExecutes logic on this element during the BubbleUp phase, immediately before this element's BubbleUp callbacks. Calling StopPropagation will prevent further invocations of this method along the propagation path.
ReleaseBlackboardReleases an associated blackboard from this GraphView.
RemoveElementRemove element from the graph.
RemoveFromSelectionRemove element from selection.
SerializeGraphElementsDefault method for serializing graph elements.
SetupZoomSetup zoom properties.
UnserializeAndPasteOperationDefault method for unserializing elements and pasting.
UpdateViewTransformUpdate the viewport transform.
ValidateTransformValidate the view transform.

Static Methods

Method

Description

CalculateFrameTransformCalculate the view transform based on zoom level and the size of the window or parent.
CollectElementsRetrieves the set of elements that match a specified condition. The matching elements are selected from an enumerable of graph elements.

Classes

Class

Description

GraphView.LayerThe layer class for placing and interacting with graph elements in a GraphView.

Enums

Enum

Description

GraphView.AskUserWhether or not to ask the user for certain actions like deleting selection.
GraphView.FrameTypeType of framing.

Delegates

Delegate

Description

GraphView.CanPasteSerializedDataDelegateDelegate for checking if serialized data can be pasted.
GraphView.DeleteSelectionDelegateDelegate for deleting selection.
GraphView.ElementResizedElement resized delegate.
GraphView.GraphViewChangedDelegate used to indicate a change in GraphView usualy done by a Manipulator.
GraphView.SerializeGraphElementsDelegateDelegate for serializing graph elements.
GraphView.UnserializeAndPasteDelegateDelegate for unserializing and pasting elements.
GraphView.ViewTransformChangedView transform changed (zoom) delegate.

Inheritance

Inherited Members