Trying to create a character naming system

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Amateur.game.dev.
extends ConfirmationDialog

var character = preload("res://Player.tscn")

signal redrawheroname()

func _on_ConfirmationDialog_confirmed():
    var newName = $LineEdit.text
    character.name = newName

Does anyone know how to do this? This is my code but it’s not working.

We’re going to need more info. What doesn’t work exactly? What is the behaviour you expect?

Hhhhh
What I see:

  • you have a signal redrawheroname, but you’re not doing anything with it.
  • you are assigning the new text to the name property of a PackedScene object. You are not instancing your character, you are just preloading the scene. In order to add your PackedScene to the game, you must call .instance() on it and then add the instance as a child to a node in the scene.
  • you really really should follow the official tutorials. They are well written and easy to follow, andyou wouldn’t struggle with the basics. I really recommend them, that’s how I started: https://docs.godotengine.org/en/stable/getting_started/step_by_step/your_first_game.html#spawning-mobs (scroll down and you’ll see an example where they spawn mobs from a preload scene)

Bernard Cloutier | 2020-10-15 18:56