CollisionPolygon2D does not show up on instance

Godot Version

4.3.stable.official

Question

Hi,

I have a little game, where I want to instance this Area2D. The reason I want to instance it instead of just pasting it in the main scene is I want to have more control over it. My setup looks like this:
image
So I designed my Polygon2D and in my code I am assigning the CollisionPolygon2D.polygon to the Polygon2D.polygon as follows:


But for some reason when I try to instance this object, the CollisionPolygon2D does not show up at all (I enabled debug > visible collision shapes).

However when I just draw the CollisiionPolygon2D manually, it works, even when instancing.

I thank everyone in advance for their help :slight_smile:

It is working on my end. I am using the following code:

extends Node2D

func _ready() -> void:
	$Area2D/CollisionPolygon2D.polygon = $Area2D/Polygon2D.polygon

with the structure:

Could you provide more information about the code and what it does?