← Back to all addons

Skill Tree 🪄🌳❕

Posted by Mr.Titan on May 18, 2025 at 6:12 PM

GameplayExperimentalFeature3.0 Verified
partyparrot 7

Tree system for skills just like Starfield, Skyrim, etc. Add/replace abilities, stats, etc.

Note: This has a lot of space for improvement and will be reviewed (one day?) 😁

Check comments for updates necessary.

Import Package (in comments)

Changes

Hero.cs

//public class HeroDataBlock : CharacterBaseDataBlock {
//...
        public DatabaseEntryReference<Skill>[] skills;
//...
}

Add properties:

        public Skill[] skills => m_skills;
        private Skill[] m_skills = new Skill[0];

Add methods:

        public Skill[] FindSkill(ESkillCategory skillCategory)
        {
            return m_skills.Where(skill => skill.category == skillCategory).ToArray();
        }
        public bool HasSkill(Skill skill)
        {
            return m_skills.Any(skl => skl == skill);
        }
        public void AddSkill(Skill skill)
        {
            var skillsList = m_skills.ToList();
            skillsList.Add(skill);
            m_skills = skillsList.ToArray();
        }

        public void RemoveSkill(Skill skill)
        {
            var skillList = m_skills.ToList();
            if (skillList.Remove(skill))
            {
                m_skills = skillList.ToArray();
            }
        }

In OnSave method add:

// after "heroBlock.recipes = m_recipe..." add:
            heroBlock.skills = m_skills.Select(skill => GameManager.Database.CreateReference(skill)).ToArray();

In OnLoad method add:

//after "m_recipes = heroBlock...." add:
            m_skills = heroBlock.skills.Select(skill=> GameManager.Database.LoadFromReference(skill)).ToArray();

NotificationSystem

Add:

        public UnityEvent<Skill> skillDetailsOpened = new();
        public UnityEvent skillDetailsClosed = new();

UIMenuManager:

In method Hide add:

// after "itemDetailsClosed" add:
            GameManager.NotificationSystem.skillDetailsClosed.Invoke();

Missing UI Skill Trigger & Menu setup

UIMenuManager

Add on method Start

            GameManager.NotificationSystem.skillsRequested.AddListener(OnSkillsRequested);

Add method (in the end like the other menus):

private void OnSkillsRequested(TaskCompletionSource<bool> onMenuClosed) => PushMenu(onMenuClosed, m_skills);

OpenUser Interface prefab, open “Screen Space UI->Menus” and drag the Skill Menu prefab imported from the package into it. Also, set the “active” on the inspector to false (just like all the other menus). Click on the object Menus and drag the SkillsMenu prefab into the property Skills.

Asset Package

Import this package that comes with scripts, a skill example and an extra ability for this skill.

Add Button in menu

Open UIGameMenuEntry.cs and add the following key to the EGameMenuAction enum:

OpenSkills

In the method OnButtonClicked add the following case:

case EGameMenuAction.OpenSkills:
    GameManager.NotificationSystem.skillsRequested.Invoke(null);
    break;

Open Game Menu prefab, duplicate one of the menu items, name it “Skills”, click on it and in the inspector set the action to “Open Skills”!

That’s it! All done!

Note: for the example ability to have effect, you need in your save to add the “Benediction” as “Bonus Ability”, and remove it from the Sheet of your hero from “Abilities”. Since abilities cannot be removed nor replaced only bonus ones.

💬 Comments (21)

Zuko Sep 05, 2025 at 04:57 PM
i jutst need to download the package or need to edit the code on those places you mentioned?
Mr.Titan Sep 06, 2025 at 08:06 AM
Both. The package has new things, the changes add things to already existing code
Zuko Sep 06, 2025 at 02:22 PM
Thank you!
Centillion Entertainment Jan 18, 2026 at 11:55 AM

public Skill[] skills => m_skills; private Skill[] m_skills = new Skill[0];

where do i add this?

SvanDark Jan 18, 2026 at 05:19 PM
Not sure if you solved this, but you should add it in your Hero.cs script
Centillion Entertainment Jan 18, 2026 at 05:20 PM
i meant where in the hero script
Centillion Entertainment Jan 18, 2026 at 05:20 PM
no i didnt solve it yet
SvanDark Jan 18, 2026 at 05:20 PM
oh, let me load up a fresh project 1 sec
❤️ 1
SvanDark Jan 18, 2026 at 05:26 PM
i added a few comments so you know what changed etc
Centillion Entertainment Jan 18, 2026 at 05:26 PM
thanks!
SvanDark Jan 18, 2026 at 05:27 PM
wait, 1 second
SvanDark Jan 18, 2026 at 05:28 PM
okay there

📜 Scripts

SvanDark Jan 18, 2026 at 05:28 PM
Make sure you have imported the package, if you haven’t you’ll get a bunch of errors
Centillion Entertainment Jan 18, 2026 at 05:30 PM
ok
Centillion Entertainment Jan 18, 2026 at 05:37 PM
still have 18 errors lol
Centillion Entertainment Jan 18, 2026 at 05:37 PM
trying to do this step right now
SvanDark Jan 18, 2026 at 05:37 PM
can you show the errors?
SvanDark Jan 18, 2026 at 05:38 PM
all i did was add the stuff from the guide, nothing else so there shouldn’t be anything wrong with the Hero script 🤔
Centillion Entertainment Jan 18, 2026 at 05:38 PM
SvanDark Jan 18, 2026 at 05:40 PM
i haven’t done this guide myself so i have no idea why you’re getting those ,if you want to you can just revert the script that i gave you (click CTRL + Z in your script), so i guess i’m not too much of help here, sorry :p
Centillion Entertainment Jan 18, 2026 at 05:40 PM
its alright thanks aways

Want to continue the conversation?