Web Graph
The web graph data class.
The WebGraph
class stores skill data. It gives an identity to a Web. Web graphs are created through the Web Creator.
Fields & Properties
webName
The searchable name of the web graph.
string
public
skillNodes
A list of all skill nodes.
List<SkillNode>
public
connections
A list of all connections.
List<Connection>
public
dataset
The dataset.
WebDataset
public
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