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

Packed Scene member variable not being accessed by function #74492

Open
gonzalezharry opened this issue Mar 6, 2023 · 3 comments
Open

Packed Scene member variable not being accessed by function #74492

gonzalezharry opened this issue Mar 6, 2023 · 3 comments

Comments

@gonzalezharry
Copy link

gonzalezharry commented Mar 6, 2023

Godot version

4.0stable

System information

Windows 11

Issue description

Hi! I've got two functions that create instances of one same packed scene, the packed scene is a preloaded global variable and the first function successfully has access to it: (It's the addend_scn member variable)
Godot Bug 2

But then, the next function that accesses the packed scene has a reference to null, you can even see that the variable to which the instance points to is also null:
Godot Bug 1

Oddly enough, the position assignment and the adding of the scene as a child of the node is being successfully executed. It could be important to note, that if you remove the create_grid() call from the ready() function, the add_results() has complete and correct access to the member packed scene variable.

Steps to reproduce

  1. Add a breakpoint to line 30 of AddendGrid.gd and play the AddendDrawer scene, you'll see that my_unit is pointing to null.

Minimal reproduction project

Sample Project.zip

@AThousandShips
Copy link
Member

AThousandShips commented Mar 6, 2023

This is a debugger issue, the debugger incorrectly shows the variable as <null> at times, you can confirm this by doing print(my_unit) and see it is not <null>.

Probably the same issue, but that has not been fully confirmed: #74297

@AThousandShips
Copy link
Member

A possible fix for this #74148

@gonzalezharry
Copy link
Author

A possible fix for this #74148

Let's wait for the pull request to be approved then.
Although it's weird that the first function can reference the packedscene in the debugger. It's the same packedscene and the instances should be of a similar size too.
A fix should check why when it is being called a second time it returns a bigger value (Keeping in mind that when only calling the function that gets the bug in the debugger, without calling the other one first, the debugger does show the value)

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

3 participants