Getting function from other script?

Does anyone know how i would be able to access functions in other scripts by a string?
so the idea behind this is in the inspector on the second script i just enter in the string section what function i want to call from its root script instead of have to manually coding rootScript.valueOne, rootScript.valueTwo or rootScript.valueThree in the second script.
I’ve tried rootScript, rootScript.(calledFunction), rootScript.“calledFunction”.
so far nothing is working :frowning:

script one

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class scriptOne : MonoBehaviour {

	public int valueOne;
	public int valueTwo;
	public int valueThree;

	void Start () {
		
	}

	void Update () {

	}
}

script two

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class scriptTwo : MonoBehaviour {

    public  scriptOne rootScript;
	public int testInt;
    public string calledFunction;

	void Start () {
		
	}

	void Update () {
            testInt = rootScript.calledFunction;
	}
}

My suggestions isnt exactly what you want, but if youre dead set on using a string to determine specific actions, it could be done like this…

public string stringVal;

void Start(){
    Run(stringVal);
}

public void Run(string s){
    if(s == "whatever1"){
        //do whatever 1
    }else if(s == "whatever2"){
        //do whatever 2
    }else if(s == "whatever3"){
        //do whatever 3
    }
}

and called from another script would just be

theScript.Run("whatever1");

You can call all public void from other script.

 rootScript.<Any Void> ();

Easiest way if you want to call a function is to use messages. This method calls the method with the given name and it takes an optional parameter. Messages will be sent to the whole gameobject and the function will be called in all the scripts on the object if they exist. Your other option is reflection, this can do much more than the SendMessage, but it’s more complicated too. If you want to know more about it, ask in comment.