Skill Tree
Last updated
Last updated
Skills for Game Creator allows you to add a skill tree system to your game.
There are two skill tree prefabs, one for the automatic generation of a skill tree based on the types and skills one relies on, and a manual one. Both feature the following functionality:
Context Menu support: Unlock a skill, add or remove it to/from the skill bar
Hover over informations: Hover over a skill to see informations about it like the required level
Skill Bar Assignments via keyboard
You can find the prefabs under Plugins/MiTschMRStudios/Skills/Resources/SkillTree
A skill tree is built like this:
Root
Header
ContainerSkills
SkillTreeContentAutomatical
SkillType
SkillHolder
Skill1
Skill2
Skill...
Skill Bar
A skill type contains so called skill holders, which contain all skills that directly rely on each other and are displayed horizontally in one row. Let's see it in action:
When you compare the hierarchy with the skill tree in the above picture, you will immediately notice what belongs to what.
The automatic skill tree, as already mentioned, uses the type of the skill and the ones it relies on to set it up. The prefab consists of three parts, the root gameobject with the SkillTreeUIManagerAutomatical
component on it and the SkillTreeContentAutomatical prefab with the SkillTreeItemsListAutomatical
component on it.
The SkillTreeUIManagerAutomatical component has seven settings and references you can set:
Setting
Description
Skill Bar Elements
References the Skill Bar where you can assign skills in the UI via keys
Skill Points Left
Gameobject with a text component on it that displays the amount of skill points left
Skills Content
Gameobject that will have the skills structure below it
Skill Distance From Top
Vertical distance from the top (bottom of the header)
Distance Between Skill Types
Vertical distance between each type section of skills
Skill Type Size
Defines how big the initial cell for a skill type section is
Skill Type Prefab
Prefab that should be spawned as a holder of all skills of this type. Has a vertical layout component on it for structuring purposes
This gameobject has the component SkillTreeItemsListAutomatical
on it, which has the following settings and references:
Setting
Description
Skills Container
The Rect Transform component of this gameobject. Will spawn the skill holders below it.
Prefab Skill
Prefab of the skill gameobject
Prefab Skill Connector Enabled
Prefab for the enabled skill connector
Prefab Skill Connector Disabled
Prefab for the disabled skill connector
Distance Between Skills In Line
Distance between the skills in one row, meaning the ones that rely on each other. In the middle of them the skill connectors will be spawned.
Prefab Skill Holder
Prefab for the skill holder
I recommend to play with the settings so you get a feeling for it.
A skill is the heart component of a skill tree. It has many settings and references:
Setting
Description
Skill Icon Enabled
References an image component used for the icon when the skill is unlocked
Skill Icon Disabled
References an image component used for the icon when the skill is locked
Tooltip Icon
References an image component used for the skill icon in the tooltip
Tooltip Name
References a text component where the name of the skill will be
Tooltip Description
References a text component where the description of the skill will be shown
Tooltip Level Required Value
References a text component where the required level for the skill will be
Tooltip Skill Points Required Value
References a text component where the required skill points for the skill will be
Tooltip Skill State Value
References a text component where the current state of the skill will be (locked / unlocked)
Tooltip Skill State Value Color Locked
The color in which the referenced text component of the tooltip skill state value is painted when the skill is locked
Tooltip Skill State Value Color Unlocked
The color in which the referenced text component of the tooltip skill state value is painted when the skill is unlocked
Image Locked
References an image component that shows if a skill is locked
Image Unlocked
References an image component that shows if a skill is unlocked
Skill Transform
The Rect Transform component of this gameobject
Prefab Context Menu
Prefab of the context menu
Event On Hover Enter
Defines the logic that will be executed when you start hovering over the skill
Event On Hover Exit
Defines the logic that will be executed when you exit hovering over the skill
The automatic skill tree has the limitation that it displays skills always in one row, even if you have multiple skills one relies on. It takes the first one and attaches it to this one. If you want skills to rely on multiple skills, you better use the manual skill tree described below.
For more control over the look, use the manual skill tree. Let's see which settings they have.
The root gameobject has only three references to set:
Setting
Skill Bar Elements
References the Skill Bar where you can assign skills in the UI via keys
Skill Points Left
Gameobject with a text component on it that displays the amount of skill points left
Skills Content
Gameobject that will have the skills structure below it
Floating Skill
Image component of the gameobject used for the drag/drop functionality
This gameobject only needs the SkillTreeItemsListManual
component on it and is then already set up. Every skill that you add below is detected automatically.
The manual skill element has four settings more than the automatic one:
Setting
Description
Skill Tree UI Manager
The root object of the manual skill tree (automatically set in the automatic one)
Skill
The skill it represents
Skill Connector Enabled
References the enabled skill connector used between two skills
Skill Connector Disabled
References the disabled skill connector used between two skills