Skip to main content

ProfessionSkillTree

A class in Root.Township, the global namespace.

A skill tree asset for one progression path: its slots, icon and model. Loaded from Resources/ProgressionTrees/; get one with GetProfessionTree.

Constructors​

MemberWhat it is
ProfessionSkillTree()Use ScriptableObject.CreateInstance instead of new; Unity loads the saved ones from assets.

Fields​

7 private and internal fields
MemberWhat it is
private bool isEnabledBacking field for IsEnabled.
private ProgressionPath pathBacking field for Path.
private GameObject pathModelBacking field for PathModel.
private Dictionary<uint, ProgressionSlot> slotMapSlots by hash, for GetSlot.
private List<ProgressionSlot> slotsBacking field for Slots.
private Sprite treeIconBacking field for TreeIcon.
private static Dictionary<ProgressionPath, ProfessionSkillTree> treeMapAll trees by path, loaded once from Resources/ProgressionTrees.

Properties​

MemberWhat it is
bool IsEnabled { get; }Whether the tree is turned on.
ProgressionPath Path { get; }The progression path this tree belongs to.
GameObject PathModel { get; }Model shown for the path.
List<ProgressionSlot> Slots { get; }The tree's skill slots.
Sprite TreeIcon { get; }Icon sprite for the tree.

Methods​

MemberWhat it is
static ProfessionSkillTree GetProfessionTree(ProgressionPath path)Returns the tree for a path, loading all trees on first call. Logs an error if there is none.
bool GetSlot(uint hash, out ProgressionSlot slot)Finds a slot in this tree by its hash.
void OnValidate()Editor: validates slots and changes any duplicate slot hashes.
2 private and internal methods
MemberWhat it is
private void EnsureFullMap()Fills slotMap from slots on first use and sets each slot's path.
private void ForwardLoad()On first load, builds the slot map and lets each slot link to the slots it inherits from.

Used in​

Members of other types that take, return or hold a ProfessionSkillTree: