public void SetName() { var inputField = GameObject.FindGameObjectWithTag("NamePanel").GetComponentInChildren <InputField>(); if (inputField != null) { _data.SetPlayerName(inputField.text); } }