Change multiple variables with function argument

I am using the new UI Button. I want a function to put under the OnClick Component. I want a function that I can reuse and just change 1 thing. Thats what I’m trying to do.

How do I change a variable in another script by, with a single function?

like:

 void Change(ThingToChange){
     VariableScript.ThingToChange = "Something";
 }
 
 Not:
 void ChangeTest1(){
     test1 = "blabla";
 }
         
 void ChangeTest2(){ 
     test2 = "blabla2";
 }

And so on. That I what is don’t want to do! I want to have only 1 void/ function that I can reuse.

Maybe you can use Generics:

https://unity3d.com/es/learn/tutorials/modules/intermediate/scripting/generics

your question is not to clear but I guess you mean somthing like this

 public  void ChangeTest( string button_fun)
    { 
         switch(button_fun)
    {
       case "test1":
            print("dosmthing");
    break;
       case "test2":
            print("dosmthing2");
    break;
    
    }
    
      }

by passing the parameter to the button and making the case you can reuse the function
One single function for all the button