0 votes

this code spawns the dialogue scene into the canvaslayer

func _start_chat():
var dialoguebar = dialogue.instance()
#does spawn, but not visible
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.

in Engine by (47 points)

1 Answer

+1 vote
Best answer

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.....

by (1,781 points)
selected by

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.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.