Component Class variables change on all componenet instances on canvas


I have developed a component that can increment or decrement using a custom component interface that has buttons on it. It uses a main component class like normal with a CreateAttributes() override. I got everything working fine on one component, but I just noticed that when I have multiple components on one canvas, that they all update when I click on one of them. I know this is because the Component Class variables are public static variables to make them accessible to the Custom UI class and delegate function.

How can I make the variables in the Component Class document accessible to the CustomUI class document while keeping them unique to the individual component? I’m just starting to wtap my head around delegates and overrides and other more advanced C# concepts.

I’ll upload the C# scripts… Any help would be much appreciated!

CustomUI.cs (15.7 KB)
IncrementComponent.cs (4.9 KB)