[Unity3D] There is no response when clicking the Unity button, maybe because of the hierarchical relationship

For UI objects on the Hierarchy panel of Unity, the objects below the hierarchy will be rendered later, that is, objects below the hierarchy will block objects above the hierarchy.
Insert image description here
So see if the button is covered by something transparent?

If this is not the reason, you can refer to other reasons why the button cannot be pressed: Unity's button does not respond to clicks

Attachment:
Use scripts to dynamically adjust the hierarchical order:
There are three methods under the Transform class:
1: SetSiblingIndex(0), which is to set the object as the first child object under the parent object, and the number in the brackets is the index;
2: SetAsFirstSibling( ), set the object as the first child object under the parent object;
3: SetAsLastSibling(), set the object as the last child object under the parent object.
Insert image description here

Guess you like

Origin blog.csdn.net/weixin_41932970/article/details/129721882