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

Static functions are not registered before the first call to _post_import when first open a project #92864

Open
Nodragem opened this issue Jun 7, 2024 · 0 comments

Comments

@Nodragem
Copy link

Nodragem commented Jun 7, 2024

Tested versions

4.3 beta1

System information

Godot v4.3.beta1 - Windows 10.0.22631 - Vulkan (Forward+) - dedicated NVIDIA GeForce RTX 2060 (NVIDIA; 31.0.15.4626) - Intel(R) Core(TM) i7-10750H CPU @ 2.60GHz (12 Threads)

Issue description

I am working on an open-source Twin-Stick Shooter starter kit.
It works very well on my machine but I started to have users telling me they could not run the project on their machine.

After investigation I found that the issue is due to using a helper class CollisionTool in import_destructible.gd that is not recognised by Godot when it first try to run the _post_import() function.

Here the code:

image

Giving the error (see the two first red lines):

image(1)

Note that this code works without any issue on my machine because CollisionTool.add_kinematic_body_to_mesh is static!

To me, it looks like a bug about timing. On a fresh start of the project, Godot seems to try importing the scenes/gltf before it has registered the static functions. Hence, it flags import_destructible.gd has containing a Parsing Error, because it references a non-existing CollisionTool class.

Note that if I reload the project and then select all my gltf files and rigth-click/reimport, the _post_import runs without any issue. Which means that Godot does register the static functions at some point. It just did not do it on time for the automatic import.

Note, for reference, a link to the issue on my repo.

Steps to reproduce

  • clone the project below and open it in Godot.
  • wait it loads
  • go in Output and scroll up to the 2 first errors

(Note: the other errors are also some sort of bug, but let's ignore them for now).

Minimal reproduction project (MRP)

link to project: https://github.com/Nodragem/twin-stick-shooter-starter-kit

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