get text unity

Code Example - get text unity

                
                        numericalScore.GetComponent<UnityEngine.UI.Text>().text = "Score : " + scoreManager.score;
                    
                
 

get text component unity

                        
                                GameObject.GetComponent<Text>().text = "Hello World!";
                            
                        
 

how to access a text gameobjceet in unity and change it

                        
                                Text text = gameObj.GetComponentInChildren(typeof(Text)) as Text;
text.text = "text stuff";
text.font = prefferedFont;