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

Objects are null if they share a name with an export category. #74921

Closed
DreamsOfGrandeur opened this issue Mar 14, 2023 · 1 comment
Closed
Labels

Comments

@DreamsOfGrandeur
Copy link

Godot version

4.0.stable

System information

MacOS 13.2.1

Issue description

When an exported category is created with @export_category, any object that shares the same name will always be Nil. A variable with the same name will work as expected if assigned after @export_category is called, but will crash if assigned before and referenced after.

Steps to reproduce

The following code will fail because Example is Nil.

extends Node


@export_category("Example")


func _ready() -> void:
	var example_class: Example = Example.new()
	
	print_debug(example_class.foo)


class Example extends Node:
	
	var foo: String = "bar"

This seems to be reproducible with any object, including built-in objects like 'Input'. However, if the @export_category call is removed or altered so that the category name differs from the class name, then the code executes as expected. The two must match exactly, including case.

Minimal reproduction project

N\A: no project files required to reproduce.

@vnen
Copy link
Member

vnen commented Mar 15, 2023

Duplicate of #73843

@vnen vnen marked this as a duplicate of #73843 Mar 15, 2023
@vnen vnen closed this as not planned Won't fix, can't repro, duplicate, stale Mar 15, 2023
@vnen vnen added the archived label Mar 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants