My problem with get_tree().paused and instancing a preloaded scene

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

I am starting my project out and have been doing well with a project until I needed to pause the sceneTree.

The game I am working on is an RPG with WarioWare style minigames.

My Issue

When I instanced one of them, I found that for whatever reason the Collisions of the Area2Ds were not being detected. The scene, when loaded separately works just fine though.

I found that if i remove get_tree().paused = true, it suddenly works just fine.

I have been receiving this error, which may have something to do with it after I pause the scene.:

the error

E 0:00:44:0374 Can’t change this state while flushing queries. Use call_deferred() or set_deferred() to change monitoring state instead
servers/physics_2d/physics_2d_server_sw.cpp:737 @ body_set_shape_disabled()
basic enemy.gd:17 @ begin_battle()

Have you tried to set the pause mode of the areas to process? Does it change something?

Also, have you tried to set the pause mode deferred? As the error wants you?

Jowan-Spooner | 2019-05-23 15:37

I’ll look into that first suggestion. Thank you.

How do I set the pause mode to defferred? I can’t find that anywhere.

AfterCadaver | 2019-05-24 01:32

Haven’t tried it but maybe get_tree().set_deffered(paused, false) could work.

Jowan-Spooner | 2019-05-24 09:01