Changing 3D text in update

Hello,

So i have a quick question, who can help me done this.
I want to show 3D Text "Score: " and also with score i want to show a counter like this "Score: " + counter
Ok so i have already done this Debug.Log("Score: "+i.ToString()); but now i want that same Debug.Log to show on the 3D Text and i just don0t know how :S What i am doing wrong or what ever. I have done it like this:
TextMesh 3dtext;
3dtext.tex="Score: "+i.ToString();

But this is not working at all :S

Hello,

Simple example using TextMesh:

1)In Game Hierarchy , create 3D Text . the object is named New Text

2)drag and drop the following script (name it text3d) to this object

using UnityEngine;

 using System.Collections;

 public class text3d : MonoBehaviour 
 {

	int counter = 0;
	TextMesh text;

	// Use this for initialization
	void Start () {
	
		text= gameObject.GetComponent("TextMesh") as TextMesh;
	}
	
	// Update is called once per frame
	void Update () {
	
		text.text = "Score: "+counter.ToString();
		counter++;
	}
 }

3)Implement the script and change the setting of your 3D text to customize it :stuck_out_tongue:

Attach a TextMesh Component to the GameObject containing the script if you haven’t already done it

And change:

TextMesh 3dtext;
3dtext.tex="Score: "+i.ToString();

By:

TextMesh 3dtext = GetComponent<TextMesh>();
3dtext.text = "Score: " +i+ToString();

@Nerevar not for me