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.
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