0 votes

For a normal scene I can do this and my challenge_number is set :

@onready var scene = preload("res://scenes/test.tscn")
var challenge_modal = scene .instantiate()
challenge_modal.set("challenge_number", 3)
add_child(challenge_modal)

I will be using change_scene_to_packed
A bit lost on how to set variables here to access in the scene change and how to use the change to packed method

Godot version Godot 4 Beta 6
in Engine by (30 points)

1 Answer

0 votes

Hey, hope I'm understanding your question right, but you should be able to set any variable in your instanced scene using the dot accessor, or whatever it's called. Ex: "challenge_modal.your_variable = your_value".
Or if you made setter functions in the packed scene, then
challenge_modal.set_your_variable(your_value)

Did that help?

by (18 points)
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 Frequently asked questions and 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 [email protected] with your username.