Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

in thread, instantiating PhysicsBody2D with a CollisionShape2D child raises error #81472

Open
space-jellyfish opened this issue Sep 9, 2023 · 1 comment

Comments

@space-jellyfish
Copy link

Godot version

4.1

System information

Godot v4.1.1.stable - Windows 10.0.19045 - Vulkan (Forward+) - integrated Intel(R) UHD Graphics (Intel Corporation; 31.0.101.4575) - 13th Gen Intel(R) Core(TM) i7-1370P (20 Threads)

Issue description

In thread, instantiating physicsbody2ds with a collision shape child raises a get_transform error.

According to https://docs.godotengine.org/en/stable/tutorials/performance/thread_safe_apis.html#scene-tree, this isn't the intended behavior.

Steps to reproduce

see project

Minimal reproduction project

gd_thread_instantiate.zip

@bitsawer
Copy link
Member

bitsawer commented Sep 9, 2023

Looks like a thread guard issue, instantiating the scene eventually calls Node2D::get_transform() which has ERR_READ_THREAD_GUARD_V() guard. Might be intentional or not.

You can work around this by calling Thread.set_thread_safety_checks_enabled(false) in the thread function, but be careful as this might not be fully supported currently.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants