My text in my TextMesh changes all TextMesh objects

I’m creating 3d TextMesh and when I change the text it changes the text for all of the meshes. I’m at a loss because I’m not even using public variables, let alone static.

Here’s my script:

public class TextObject : MonoBehaviour {

	private string text = "Hello World";
	private int tapCount = 0;
	private float tapWindow = 0;
	private TouchScreenKeyboard keyboard;

	 

	// Use this for initialization
	void Start () {

		keyboard = TouchScreenKeyboard.Open (text, TouchScreenKeyboardType.ASCIICapable, false, false, false, false, text);


	
	}
	
	// Update is called once per frame
	void Update () {




		if(tapWindow > 0f)
		{
			tapWindow -= Time.deltaTime;
			if(tapCount >= 2)
				DoubleTapped ();
		}

//		if(keyboard.active)
//			text = keyboard.text;
		if(keyboard.done)
		{
			

			text =keyboard.text;
			GetComponent<TextMesh>().text = text;
			if(text == "")
			{
				Destroy(gameObject);
			}
		}
		
	}
	
	public void SwitchMode()
	{
		tapCount++;
		tapWindow +=1f;

	}



	
	public void DoubleTapped()
	{

		keyboard = TouchScreenKeyboard.Open (text, TouchScreenKeyboardType.ASCIICapable, false, false, false, false, text);

	}


}

I removed some parts of the script because they’re easily not related (Destroy, for instance). However, this is probably 95% of the script. What am I missing?

If this script is attached to all your TextMesh objects, then it will change all of them for sure.

Why? Because all of them are listening for the “keyboard.done” to be true, all of them are running at the same time.

Just use this script on one object and only it will change.
If u want to have this script on all your TextMesh objects, then you have to code a way to identify which one you are editing and when “keyboard.done” is true, just set the value for that one.