Question by 
               VeronikaKohler · Mar 06, 2016 at 08:16 PM · 
                c#scripting problemuitext  
              
 
              UI Text created from C# Script
Hello , i'm new to this forum and to unity. :) I think what i'm trying to do is quite simple but i just can't figure out how to do it even after using google for hours and testing several approaches i found on the internet. I simply want to create an UI text with a C# script only and without using the unity editor. My last approach was the following :
         GameObject newText = new GameObject( "Text Example", typeof(RectTransform));
         var newTextComp = newText.AddComponent<Text>();
         newTextComp.text = "Hello World";
         newTextComp.color = Color.black;
         newTextComp.alignment = TextAnchor.MiddleCenter;
         newTextComp.fontSize = 10;
         newText.transform.SetParent(transform);
 
               There's no exception but my programm isn't showing any text either. Why is that so and how can i solve my problem??
               Comment
              
 
               
              Your answer