Bug with Randomized Skill Tree Using Lighting

My Goal:
I’m trying to create a randomized skill tree that will have specific areas that fill out with specific types of perks, while using lighting to limit the amount of forward thinking required of the player.

The Process:
As the scene runs the shape of the skill tree should be created, and then a number of initial tiles should be selected at random and have initial lighting and animations. These initial lights should then be given an object variable in accordance with the animation of their perk (in this case animations 1-5 giving it the value 1, and 6-10 giving it the value 2). Any perk in collision with the light should then be given a random animation from within the group (that being group 1 giving the animations 1-5 and group 2 giving 6-10). When a perk in the light is selected a light is then created on it, and this light to should be given a value, and that value expanded to nearby perks.

The Problem:
When I run the scene it creates the skill tree and the initial randomly selected perks just fine, but the expanded perks in collision with the light all fall into only one group. Whichever group I put second in the event that changes the animations applies for all expanded perks, not just ones expanding off of that group. Of note the initial zones work sometimes, but working is less common then working and expanded zones never work.


I’m apparently not allowed to post more images sense I’m new so I’ll reply with the others I guess.

Game with lights off:

Game with lights on:

“Working” occasionally:

Game with lights off, unexpanded: