0 votes

this code spawns the dialogue scene into the canvaslayer

func _start_chat():
print("starting")
var dialoguebar = dialogue.instance()
#does spawn, but not visible
get_node(canvasLayer).add_child(dialoguebar)
dialoguebar.position = position

replacing the textbox with another scene to instance still instances a non-visible scene

making it instance as a child of the scene that runs the code instead of a child of CanvasLayer also makes the textbox not visible, but a different object spawned that way is visible
Objects already in the canvaslayer, like a health UI, or the scene i am trying to spawn, when the game starts are visible, but when they are instanced at runtime, they are not visible

the function does get called, the right scene is attached and does get deployed into the world. I'm not sure what else to share that would be relevant to this issue.

asked Jul 1 in Projects by Aravash (40 points)

1 Answer

+1 vote
Best answer

Hello,
Is the object being instanced off screen somehow?
What is it's global position when spawned?
I had an issue with with instances spawning and I couldn't see them, they were just on the screen. I added a camera, made it active and zoomed out. There they were.....

answered Jul 1 by deaton64 (1,205 points)
selected Jul 1 by Aravash

Thankyou! Turns out I was setting the position of the new scene to the position of the scene that instances it, had to use a magic vector to position it properly though, would be good to know how to fix that.
Currently works with dialoguebar.global_position = Vector2(160,152)

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.