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

Godot 4.3.beta1 can_instantiate results in Invalid call. Nonexistent function 'can_instantiate' in base 'GDScript'. #93193

Closed
MikeSchulze opened this issue Jun 15, 2024 · 4 comments

Comments

@MikeSchulze
Copy link

Tested versions

v4.3.beta1.mono.official [a4f2ea9]

System information

Windows 11

Issue description

I run into this error after upgrading to beta1.

On my tooling i have a function to evaluate the given argument is type e.g. a Class type

static func is_type(value :Variant) -> bool:
	# is an build-in type
	if typeof(value) != TYPE_OBJECT:
		return false
	# is a engine class type
	if is_engine_type(value):
		return true
	# is a custom class type
	if value is GDScript and value.can_instantiate():
		return true
	return false
	
static func is_engine_type(value :Object) -> bool:
	if value is GDScript or value is ScriptExtension:
		return false
	return value.is_class("GDScriptNativeClass")	

But it is broken now with Godot 4.3.beta1

Invalid call. Nonexistent function 'can_instantiate' in base 'GDScript'.

Steps to reproduce

Use the code to reproduce, assigning the script instance to a Variant results into this error now.

	var script :Variant = GDScript.new()

	script.can_instantiate()

Minimal reproduction project (MRP)

n/a

@AThousandShips
Copy link
Member

Thank you for reporting, consolidating in:

See there for more details, if you think something was missed about this and it's not the same issue, please comment here and it can be reopened

@AThousandShips AThousandShips closed this as not planned Won't fix, can't repro, duplicate, stale Jun 15, 2024
@MikeSchulze
Copy link
Author

@AThousandShips looks like the same root cause, yes.
So far I understand an assign to an un-typed variable is internal handled as a Variant, right?

@AThousandShips
Copy link
Member

It is yes the underlying data is Variant

@MikeSchulze
Copy link
Author

Ok so than the beta1 breaks a lot :(, o need to wait for the next iteration

MikeSchulze added a commit to MikeSchulze/gdUnit4 that referenced this issue Jun 16, 2024
# Why
see #501

# What
- added Godot 4.3.beta1 to the CI workflow
- fixed enum default value warnings
- fixed unused signal warnings
- fixed missing test-suite icon resource
- fixed failing input action tests
- use typed values in GdObject to avoid bug
godotengine/godot#93193
- add `TYPE_PACKED_VECTOR4_ARRAY` constant to be used on Godot versions
less than 4.3 (is introduced with beta1)
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

2 participants