I suddently can't press buttons in my game anymore

I almost finished my game. After I added a UI as the health bar of the enemy, everything went wrong. All of my buttons (from selecting tower to the game over scene's buttons) are unavailable to interact. Although my code didn't change anything that related to it.

I don't know what was the problem. Can you help me?

Upvotes: 0

Views: 60

Answers (1)

dogiordano
dogiordano

Reputation: 714

Most likely, you added a transparent Canvas with a GraphicRaycaster which is intercepting all your inputs.

GraphicRaycaster makes it so the Canvas can receive input events. That combined with the SortOrder can stop these events to be passed down to other Canvases.

You can either remove the GraphicRaycaster from this new Canvas showing the health bar, or set RaycastTarget = false on every Image that shouldn't intercept input events.

Upvotes: 1

Related Questions