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

Invalid call. Nonexistent function 'new' in base 'Nil'. if you use @export_group with same class name #73843

Closed
Ughuuu opened this issue Feb 23, 2023 · 6 comments · Fixed by #73870 or #78254

Comments

@Ughuuu
Copy link
Contributor

Ughuuu commented Feb 23, 2023

Godot version

4.0 RC 3

System information

Macbook m1

Issue description

If I normally use:

Skeleton2D.new()

if works.

If I use:

@export_group("Skeleton2D")
...
Skeleton2D.new()

I get error: Invalid call. Nonexistent function 'new' in base 'Nil'.

Steps to reproduce

  • Run a script where you have @export_group with same name as a node class name that you use .new() on.
extends Node2D
class_name Test

@export_group("Skeleton2D")

# Called when the node enters the scene tree for the first time.
func _ready():
	var skeleton = Skeleton2D.new()


# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta):
	pass

Minimal reproduction project

BugNew.zip

@anvilfolk
Copy link
Contributor

anvilfolk commented Feb 23, 2023

Behavior present in all RCs.

I believe that the script is checking for its own properties, and export group is effectively exporting a property named Skeleton2D. This will shadow the global Skeleton2D. I'm not certain that I'd consider this a bug necessarily, but perhaps at least a warning when @export_group shadows a global name?

@YuriSizov
Copy link
Contributor

YuriSizov commented Feb 25, 2023

Reopening because #73870 has been reverted.

@Shadowblitz16
Copy link

I run into this when exporting a group called Input and then I couldn't use the engine Input singleton

@PoolloverNathan

This comment was marked as duplicate.

@Shadowblitz16

This comment was marked as off-topic.

@YuriSizov
Copy link
Contributor

There is no need to bump this, this is a known and confirmed issue.

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