0 votes

I'm currently in the process of trying to port my game to Godot 4.0 - so far its not going too great but it works fine where I've went in and manually fixed the issues. But this is one I just cannot fix no matter what. See attached image.

https://imgur.com/a/WBdRZZR

Any ideas on how to fix this?
edit: sorry if my handwriting's a bit hard to read. error is "Expression is of type "null" so it can't be of type "Callable"".

Godot version 4.0 beta 3
in Engine by (42 points)
edited by

Are you sure your the error is happening in the code snippet shown in your pic? I don't see how / why that should be the case and I don't see anything there related to a callable...

1 Answer

0 votes

I think your problems is in order of operations. First you trying to check if i-th instance is valid, and only after it you trying to check if i is not null. Expressions are evaluated from left to right and you should simply first check if i is null and only then attempt to check if i-th instance is valid. I.e. change your if from this:
if is_instance_valid(i) and not(i is null):
to
if not(i is null) and is_instance_valid(i):
also you can probably replace not(i is null) with i != null

by (1,650 points)
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.