Skip to content

Fix error in simple_spawner.gd with Godot 4.2.2 #242

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

Merged
merged 1 commit into from
Oct 2, 2024

Conversation

dylanmccall
Copy link
Contributor

With Godot 4.3, it is possible to use is_instance_valid as a Callable. To support Godot 4.2.2, we must use an anonymous function instead.

With Godot 4.3, it is possible to use is_instance_valid as a Callable.
To support Godot 4.2.2, we must use an anonymous function instead.
@@ -79,7 +79,7 @@ func spawn_once():
if scenes.size() == 0:
return

_spawned_scenes = _spawned_scenes.filter(is_instance_valid)
_spawned_scenes = _spawned_scenes.filter(func(instance): return is_instance_valid(instance))
Copy link
Contributor

@starnight starnight Oct 2, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I try to understand the func() and instance. Then, I found it is Godot 4 lambda functions.

@starnight starnight merged commit 22c0777 into main Oct 2, 2024
3 checks passed
@starnight starnight deleted the godot-4-2-compatibility branch October 2, 2024 04:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants