using UnityEngine; using UnityEngine.UI; using TMPro; /// /// Attach to any GO in the main menu scene (e.g. UIManage). /// Finds the "name" canvas button at runtime and converts it into a /// fully functional TMP_InputField — preserving its RectTransform position/size. /// public class PlayerNameInput : MonoBehaviour { void Start() { var nameGO = GameObject.Find("name"); if (nameGO == null) { Debug.LogError("[PlayerNameInput] 'name' GO not found."); return; } var rt = nameGO.GetComponent(); if (rt == null) { Debug.LogError("[PlayerNameInput] 'name' has no RectTransform."); return; } // Remove incompatible components (Button blocks input; old broken TMP_InputField) var btn = nameGO.GetComponent