Tutorial Unity I want change character name's in game, some suggestions?

Roh Sousa

Formerly '1-800-aesthetics'
Nov 18, 2021
90
34
Fisrt of all, is my first time posting somenting.
if somenting is no right sorry i'm not good in english.
Let's start.
"I don't know how mark in spoiler", i want change an character name in game using ren'py is more easy like we can use URM from 0x52
But Unity until i know now don't have somenting similar. so thats code i get with help from ChatGPT can be used?or will broken game?


using UnityEngine;
using UnityEngine.UI;

public class DialogManager : MonoBehaviour
{
public GameObject dialogBox;
public InputField playerNameInput;
public Text playerNameText;

private void Start()
{
dialogBox.SetActive(false);
}

public void OpenDialog()
{
dialogBox.SetActive(true);
playerNameInput.text = playerNameText.text; // Preenche o campo de entrada com o nome atual
}

public void SavePlayerName()
{
playerNameText.text = playerNameInput.text; // Atualiza o nome do jogador com o novo nome
CloseDialog();
}

public void CloseDialog()
{
dialogBox.SetActive(false);
}
}