Make Local variable share between only 2 functions

Does anyone know a way to share a variable between only 2 functions in a script while keeping it’s value?

Not sure i understand ur question exactly…

A function or method are a way to control a variable if need be.

If you want a value to never change you can make it constant like

const string KEY_MYKEY = "MEYKEY";
const int CONST_VALUE_1 = 10;
const float CONST_VALUE_2 = 8.65f;

or simply set a value and Not change it in any function or method and make something else = it’s value

public string newString = "Don't Change";
public void OnGetStringValue(string messageToChange)
    messageToChange = newString;

alternatively you can use a get method also

string newString = "";
void Awake()
    SetDontChangeString = "Don't Change";
public string GetDontChangeString { get { return newString; } }
public string SetDontChangeString { set { newString = value; } }
public void OnChangeMessage(string messageToChange)
   messageToChange = GetDontChangeString ;

what exactly is your goal?

We can do other things like make lists of word to display in the scene.

//Requires 'using UnityEngine.UI;' at the top outside class to use
List<string> listOfWords = new List<string>()
GameObject prefabButton;

//should populate the panel with a bunch of prefabs with the string changed. Usually i use a ScrollView and enter in it's content GameObject. I'll then add a vertical or horizontal layout group to it and adjust settings according to my prefabs.
public void DisplayOptions(GameObject contentPanel)
    for(int i = 0; i < listOfWords.Count; i++)
        GameObject obj = Instantiate(prefabButton, contentPanel.transform); = listOfWords*;*

//Change Name of Text in find if you have changed the button text Component name if you used a default unity button.
obj.transform.Find(“Text”).GetComponent().text = listOfWords*;*