Web Graph
🕸️ WebGraph Class
A graph that contains skills and connections.
Namespace:
Esper.SkillWeb.Graph
Inherits from:
SkillWebObject
Type:
class
📦 Fields
public
webName
string
The searchable name of the web graph.
public
skillNodes
List<SkillNode>
A list of all skill nodes.
public
connections
List<Connection>
A list of all connections.
public
dataset
WebDataset
The dataset.
🔍 Properties
public
DatabaseRecord
WebRecord
The database record.
🧰 Methods
public
GetTitle()
string
Gets the web graph title. This is either the display name from the dataset or the searchable web name.
public
CreateCopy()
WebGraph
Creates a copy of this web.
public
CopyData(WebGraph)
void
Copies all data of another web, excluding ID.
public
GenerateDataset()
void
Generates the dataset with the dataset reference set from Skill Web's settings (editor only).
public
UpdateAssetName()
void
Updates the name of the asset (editor only).
protected override
GetID<T>(string)
int
Gets an ID for the object.
public virtual
GetAvailableNodeID()
int
Returns an unused node ID.
Creating a Web Graph
var webGraph = ScriptableObject.CreateInstance<WebGraph>();
Getting a Web Graph
You can get a web graph with the SkillWeb.GetWebGraph
method by passing the ID or name of the web graph as a parameter.
var myWebGraph = SkillWeb.GetWebGraph("My Web");
To get all web graphs, use SkillWeb.GetAllWebGraphs
. Note: this can be a lengthy task.
var allWebGraphs = SkillWeb.GetAllWebGraphs();
Custom Dataset
You can create a custom dataset for webs, allowing you to set custom data for each skill—making customization easier.
Step 1: Inherit From WebDataset
Create a new class and inherit from the WebDataset
class.
using Esper.SkillWeb;
using UnityEngine;
public class MyWebDataset : WebDataset
{
}
Step 2: Create Asset Menu Option
WebDataset
is a ScriptableObject
class, which means it can be added to the asset menu.
using Esper.SkillWeb;
using UnityEngine;
[CreateAssetMenu(fileName = "My Web Dataset", menuName = "Skill Web/Datasets/My Web Dataset")]
public class MyWebDataset : WebDataset
{
}
Step 3: Override Methods
Override the required method. There's only the GetDisplayName
method, which is not used anywhere by default. How you use this is up to you.
using Esper.SkillWeb;
using UnityEngine;
[CreateAssetMenu(fileName = "My Web Dataset", menuName = "Skill Web/Datasets/My Web Dataset")]
public class MyWebDataset : WebDataset
{
public override string GetDisplayName()
{
// Implement custom code here
return "";
}
}
Step 4: Add Custom Fields
Add your custom fields. If they are serializable, they will be available for each web in the Web Creator.
using Esper.SkillWeb;
using UnityEngine;
[CreateAssetMenu(fileName = "My Web Dataset", menuName = "Skill Web/Datasets/My Web Dataset")]
public class MyWebDataset : WebDataset
{
public float myCustomFloat;
public override string GetDisplayName()
{
// Implement custom code here
return "";
}
}
Step 5: Set For All Web Graphs
All you have left to do now is to create a new instance of your custom dataset from the asset menu and set it as the dataset reference for web graphs from Settings.
Last updated