0 votes

I have built in script in Catcher. I have sepeareted script for Bunny.
I got an error because Catcher is a packedScene. Bunny is a script.
How can I use 'is' expression with built-in scripts?

var Bunny = preload("res://Scenes/Bunny.gd")
var Catcher = preload("res://Scenes/Catcher.tscn")
#I have no .gd for Catcher.

    if (myObject is Bunny or myObject is Catcher):
       doThigns()
in Engine by (327 points)
edited by

You declared a variable as var Bunny. What is that Const.Bunny? What is Const in other words?

Fixed. Removed Consts.

1 Answer

0 votes

Just remove the Const part from your code and it shall work.

by (1,892 points)

The question is about the "is" expression and packaged scene with built-in scripts.

Try using the == operator instead of the is keyword.

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.