text input Scripting ApI unity code example

Example 1: unity how to change text in script

Text myText = GameObject.Find("Canvas/Text").GetComponent<Text>();
myText.text = "Your text changed!";

Example 2: prompt for array unity c# editor scripting

[CustomEditor(typeof(RoomItem))] public class RoomItemEditor : Editor {
   public override void OnInspectorGUI() {
     serializedObject.Update();
     var controller = target as RoomItem;
     EditorGUIUtility.LookLikeInspector();
     SerializedProperty tps = serializedObject.FindProperty ("targetPoints");
     EditorGUI.BeginChangeCheck();
     EditorGUILayout.PropertyField(tps, true);
     if(EditorGUI.EndChangeCheck())
       serializedObject.ApplyModifiedProperties();
     EditorGUIUtility.LookLikeControls();
     // ...
   }
 }