Search Unity

Question Add text mesh pro text input UI in inspector

Discussion in 'UGUI & TextMesh Pro' started by saifshk17, Oct 20, 2021.

  1. saifshk17

    saifshk17

    Joined:
    Dec 4, 2016
    Posts:
    488
    I am trying to find a way to add text mesh pro-Text Input box inside a function. Such that when this function is referenced to a button, a text mesh-Text Input box appears where I can easily add texts. My motive is to display the whole text input when referenced to a button.

    Code (CSharp):
    1. using System.Collections;
    2. using System.Collections.Generic;
    3. using TMPro;
    4. using UnityEngine;
    5.  
    6. public class ReferenceTextMeshPro : MonoBehaviour {
    7.  
    8.     public TextMeshProUGUI textObj;
    9.  
    10.     public void ReferencedText (TextMeshProUGUI textName) {
    11.         textObj.text = textName.text;
    12.     }
    13. }


     
  2. aaaaaaaaaaaaaaaaaaaaa09908

    aaaaaaaaaaaaaaaaaaaaa09908

    Joined:
    May 25, 2022
    Posts:
    2