Create an empty 2D project , when I add empty node ,set its position

I created an empty 2D project. In the project, I will create a node and call the setPosition function to set the position of the node. When observing the node attributes, I found that in the function I called setPosition, I passed CC Ver2 vector, but calling the setPosition method parameter passes Ver3 data, resulting in an additional z-axis data, which is 0, but this causes the node not to be displayed.

You can show your demo, i have tested and it works well.
57649.zip (4.9 KB)

1 Like

set Position:

node.setPosition(x, x, 0);
node.setPosition(new Vec3(x, x, 0));

set position will work for both styles.

check node._layer value.
set node._layer = 33554432

try this _layer will may work.

1 Like