+1 vote

So, we can do:

export(AudioStreamSample) var Music_Stinger
export(bool) var Trigger_On_Enter

How can I export a CollisionPolygon2D? I have a area2d node saved, which has a child CollisionPolygon2D, it is a trigger for musics and stingers in the game, however, I would like to know if it's possible to expose in the inspector a CollisionPolygon2D similarly like the above, so I could customize a collision shape for the map,

in Engine by (373 points)

1 Answer

0 votes

You can save the CollisionPolygon2D node as a scene, and then export a var like this:

export(String, FILE, "*.tscn") var my_collision_polygon_scene

func _ready():

If the collision polygon node is already in the scene tree for some reason, you can export a NodePath and duplicate the node:

export(NodePath) var my_collision_polygon_node_path

func _ready():
by (1,238 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.