Tag Info

Hot answers tagged


You seem not to have a TextMesh component in your game object, and you are not checking if GetComponent method has returned any. You can add it once at runtime if it doesn't exist: var text = gameObject.GetComponent(TextMesh); if( text == null ) { text = gameObject.AddComponent(TextMesh); } Or to make it better, you can make var text a private class ...

Only top voted, non community-wiki answers of a minimum length are eligible