Changed the code to set the position on
_enter_tree
and using
process_priority
to make sure all of
the steps are done in the correct order, but this
still doesn't produce the expected behavior. It's
not clear to me when Godot renders the scene when
you swap to it, because it seems nonsensical to say
that it will render a scene before
_enter_tree
has been called for all of
the nodes, because saying so would mean that it is
rendering a scene that hasn't finished loading
yet.
It could be possible that there is some kind of
cached state, where even though the data has the
correct values, the incorrect values have been sent
to render. I'm not sure how to suss out this issue
without more engine knowledge.
crazy_stewie
suggested I could use RenderDoc, which I
think could be useful for diagnosing this specific
potential issue.
I'd like to get a definitive answer on when exactly it will render a newly loaded scene since I feel like that will be a significant piece of understanding I should know. I'll have to do some investigation on this in the future.
crazy_stewie
also suggested that I
might also be able to use
set_render_loop_enabled()
to disable
rendering until the new position is set. I think I
might also be able to use a combination of
set_render_loop_enabled(false)
and
force_draw()
to do a step-by-step
analysis of the problem.