ramokz / phantom-camera

👻🎥 Control the movement and dynamically tween 2D & 3D cameras. Built for Godot 4. Inspired by Cinemachine.
https://phantom-camera.dev/
MIT License
1.93k stars 62 forks source link

Parser Error: Could not find type "Camera3DResource" in the current scope when altering C# scripts #213

Closed PokemonScholar closed 2 months ago

PokemonScholar commented 5 months ago

Issue description

When trying to run my project in the editor after making various changes to my C# code (completely unrelated to PhantomCamera), I sometimes get the error 'Parser Error: Could not find type "Camera3DResource" in the current scope.' This only seems to happen after re-compiling my altered C# scripts; once the error appears, re-running the project resolves it.

Here's what the error looks like:

PhantomCameraBug

I don't reference Camera3DResource in any of my C# scripts, the error seems to point to phantom_camera_3D.gd at line 101. For some reason the project can't seem to find Camera3DResource when initially compiling, but then finds it after running again.

I'm working in the .NET version of Godot 4.2.1. Could this error somehow be related to using C# scripts?

Appreciate any help looking into this!

Steps to reproduce

In my project with PhantomCamera set up:

  1. Open a random C# script.
  2. Alter the code in some way (could be as small as entering a new line).
  3. Run the project in Godot.
  4. The error appears at an unpredictable frequency (maybe 20% of the time)

It's difficult for me to provide a project since I have many addons that break the project when trying to reduce it to a Minimal reproduction project, but if there's any interest I can help make a project that reproduces this.

(Optional) Minimal reproduction project

No response

ramokz commented 5 months ago

Have a hunch this will be resolved in the 0.7 release, as it will fundamentally change the property system, but will run some tests and see if I can replicate it still.

PokemonScholar commented 5 months ago

Have a hunch this will be resolved in the 0.7 release, as it will fundamentally change the property system, but will run some tests and see if I can replicate it still.

Cheers thanks for looking into this! Let me know if you'd like me to test any potential fixes on my end, happy to help how I can. :]

ramokz commented 2 months ago

If you have updated to the latest release, does that resolve your issue?

Natorkawl commented 2 months ago

I had the same bug before 0.7v, which seems to fix it (testing several times by repeating the method described above).

Thanks for the fix !

ramokz commented 2 months ago

Thanks for testing @Natorkawl!

Closing issue, but feel free to reopen if it appears again.