Class NavGraphViewAsset
Representation of a navigation graph as a Unity asset. This asset contain a hierarchy of NavGraph instances.
Inherited Members
Namespace: Unity.AppUI.Navigation
Assembly: Unity.AppUI.Navigation.dll
Syntax
[CreateAssetMenu(fileName = "New Navigation Graph.asset", menuName = "App UI/Navigation Graph")]
public class NavGraphViewAsset : ScriptableObject
Properties
isEmpty
Whether this navigation graph is empty.
Declaration
public bool isEmpty { get; }
Property Value
Type | Description |
---|---|
bool |
nodes
The nodes of this navigation graph.
Declaration
public IEnumerable<NavGraphViewNode> nodes { get; }
Property Value
Type | Description |
---|---|
IEnumerable<NavGraphViewNode> |
rootGraph
The root graph of this navigation graph.
Declaration
public NavGraph rootGraph { get; }
Property Value
Type | Description |
---|---|
NavGraph |
Methods
AddNode(NavGraphViewNode)
Add a node to this navigation graph. The component will be saved as a sub-asset of this graph.
Declaration
public void AddNode(NavGraphViewNode node)
Parameters
Type | Name | Description |
---|---|---|
NavGraphViewNode | node | The component to add. |
CanNavigate(NavDestination, NavDestination, string)
Find a destination by its id.
Declaration
public bool CanNavigate(NavDestination from, NavDestination to, string route)
Parameters
Type | Name | Description |
---|---|---|
NavDestination | from | The source destination. |
NavDestination | to | The destination to find. |
string | route | The route to take to reach the destination. |
Returns
Type | Description |
---|---|
bool | True if the destination can be reached from the source destination, false otherwise. |
Exceptions
Type | Condition |
---|---|
ArgumentNullException | Thrown if the destination is null. |
FindDestinationByRoute(string)
Find a destination by its id.
Declaration
public NavDestination FindDestinationByRoute(string route)
Parameters
Type | Name | Description |
---|---|---|
string | route | The id of the destination to find. |
Returns
Type | Description |
---|---|
NavDestination | The destination if found, null otherwise. |
RemoveNode(NavGraphViewNode)
Remove a component from this navigation graph. The component will be destroyed.
Declaration
public void RemoveNode(NavGraphViewNode node)
Parameters
Type | Name | Description |
---|---|---|
NavGraphViewNode | node | The node to remove. |
TryFindAction(string, out NavAction)
Find an action by its id.
Declaration
public bool TryFindAction(string actionId, out NavAction action)
Parameters
Type | Name | Description |
---|---|---|
string | actionId | The id of the action to find. |
NavAction | action | The action if found, null otherwise. |
Returns
Type | Description |
---|---|
bool | True if the action was found, false otherwise. |