The Godot Q&A is currently undergoing maintenance!

Your ability to ask and answer questions is temporarily disabled. You can browse existing threads in read-only mode.

We are working on bringing this community platform back to its full functionality, stay tuned for updates. | Twitter

0 votes

This is a very confusing issue and I can't even reproduce it outside my project.
I have a node of a class that exits as a scene on a tilemap. This node is of class Player. Player is derived from Pushable, which is derived from Actor. In Actor, I have the line @onready var level = get_parent()
This is then used anytime the node needs to interact with the TileMap level it exists in. Sometimes when I try to run my project it gives me the error: "Parser Error: Identifier not found: level" on line 16 of The code looks like this:

func _ready():
     level.player = self

This error occurs for any reference to variables declared in Actor.
If I change player to extend actor it fixes the issue, so it has something to do with extending a derived class of actor

I really have no idea why this happens, at first it was only in certain scenes, but now after changes that seem unrelated (storing levels in the level select as Packed Scenes instead of Tile Map Patterns) it's happening in my main scene as well. If any more information about this is needed please ask!

Godot version 4.0.2
in Engine by (16 points)
edited by

What exactly do you want to do? Although the explanation of the whole project is too much, where do you get the error and what are you having trouble doing?

Thanks for your reply! I'm making a puzzle game.
Actor is the class for anything that exists on the tile map
Pushable is the class for Actors that get pushed when another actor moves into them
I want player to extend Pushable, but when I do that it sometimes (it was working when I first implemented it, and it seems almost random when the engine decides it doesn't work anymore) the parser can't find identifiers from Actor when I try to run it.
Originally this was only happening in exports of the game. Then it started happening when I would try to run a scene of a level, but not when running the level select. Now it's happening when I run the level select as well.

Hi, I have exactly the same issue :

I have this class hierarchy : A <- B <- C.
A has a member _member. When I use it in class C and launch the project, I get this error : Parser Error: Identifier not found: _member.
However, I have no troubles to use B members in C, or A members in B.

However, I can't reproduce it in a simple project. Did you manage to do it since you posted ?
I noticed that the parser error happens depending on where I use the child class type C. I guess the engine is parsing it at a different time and this may or not produce the error.

I feel it's a bug, we should definitively try to reproduce it and post it on github.

1 Answer

0 votes

Hi !

This is a bug. I was able to create a minimal reproduction project and thus post an issue on Github :

It's being worked on by the community.

As a work-around before it's fixed, you can try to change your autoloads order in Project Settings.

by (14 points)
edited by
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.