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

Identifier "PhantomCamera2D" not declared in the current scope #298

Open
HeavensSword opened this issue May 12, 2024 · 1 comment
Open

Comments

@HeavensSword
Copy link

HeavensSword commented May 12, 2024

Issue description

I'm getting the error "Parse Error: Identifier "PhantomCamera2D" not declared in the current scope." intermittently when hitting play from the Godot editor. This has been happening more frequently it seems like, especially after updating to the latest version. Sometimes it runs, other times it fails.

When the error occurs, it points to this line (348):

## Called when a [param PhantomCamera] is added to the scene.[br]
## [b]Note:[/b] This can only be called internally from a
## [param PhantomCamera] node.
func pcam_added_to_scene(pcam: Node) -> void:
    if is_instance_of(pcam, PhantomCamera2D) or is_instance_of(pcam, PhantomCamera3D): <-- This line 
        _pcam_list.append(pcam)

        if not pcam.tween_on_load:
            pcam.set_has_tweened(self, true) # Skips its tween if it has the highest priority on load

        _find_pcam_with_highest_priority()

    else:
        printerr("This function should only be called from PhantomCamera scripts")

Steps to reproduce

I'm really unsure as it seems to happen randomly upon hitting play. I'm not even using PhantomCamera2D in my game.

(Optional) Minimal reproduction project

No response

@ramokz
Copy link
Owner

ramokz commented May 12, 2024

If you have updated the addon from version 0.6.x ⇾ 0.7 within a project, then it's entirely possible that there's some lingering code in one of the hidden Godot directories that hasn't properly updated the name change of phantom_camera_2D to phantom_camera_2d — lowercased “d” at the end. Creating a new project and transferring over the res:// content might solve it then.

If the above doesn't help, would you be able to share a Minimal Reproduction Project (MRP) where that issue happens?
Mainly so I can see what setup and logic could potentially trigger this.
Haven't come across it myself, and there's not much I can do until I can replicate and verify that a fix would work.

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

No branches or pull requests

2 participants