The method "Area" isn't declared in the current class.

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Dumuz

I’m trying to instance an Area and CollisionShape to another scene I’m also instancing in under certain parameters. Spatial doesn’t accept me making a variable with these nodes. Example:

func ranged(source):
       var temp_area = Area()
	   var temp_collision = CollisionShape()

How can I script this to be accepted under a script that inherits from a Spatial node?

:bust_in_silhouette: Reply From: kidscancode

You need to make a new instance of the class:

var temp_area = Area.new()
add_child(temp_area)

oh, i forgot about the “.new” part! >.< Thanks!

Dumuz | 2020-05-04 21:54