Problem with Tween in godot 3.2

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Chavelier

I have a problem, when i try to launch my game made in 3.1 there is an error with Tween :

E 0:00:07.736   start: Tween was not added to the SceneTree!
  <Erreur C ++> Condition "!is_inside_tree()" is true. Returned: false
  <Source C++>  scene/animation/tween.cpp:825 @ start()
  <Pile des appels> @ start()
       @ _shoot()
   @ _physics_process()

I don’t understand why it’s happening… With another project made on 3.1 there is not this problem… Can you help me please ?

:bust_in_silhouette: Reply From: jgodfrey

If you created the tween in code, you need to add it to the scene tree before you can use it. You can do that via the add_child(<your_tween>) method.

But i don’t create the Tween in code

Chavelier | 2020-02-17 11:33

It sounds like this issue:

Tween was not added to the SceneTree! · Issue #32464 · godotengine/godot · GitHub

According to that, the problem could be reproduced in a pre-release of 3.1, but not in 3.1 stable. Are you running 3.1 stable?

Can you upgrade to 3.2 to see if it works there?

Additionally, at the end of the above-linked thread, there’s a mention of some custom error handling code being called prior to the Tween being added, which caused the error. Apparently, calling that code via call_deferred() fixed the issue in that report…

jgodfrey | 2020-02-17 15:58