Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Unity collider click vs. UI button click

Hello,

I wonder which of those options is more performance-efficient: using collider with script to react on click or putting UI button over object to know when its clicked.

Thanks for answer.

Answers

  • Both have pros and cons.


    Using ui button will be easy to visualize interactions but sometimes it will not look good even sometimes the ui will not fit the screen perfectly. And sometimes it can be outside the safearea of screen.


    Different resolution screens needs some adjustments to fit perfectly.


    Using on collider to interact will look good in scene if you have perfect scene adjustments. Sometimes it will not works if the object is not vissible properly or hidden under another object.

    For this you dont have to worry much about screen fitting cuz all you have to do is set the camera in particular angle so that this object will appear correctly.


    If the game is small than it is easy to use both but if the game is big and player moves continously that UI is best.


    There are also some assest on the asset store for good looking UI sprites and etc.

  • edited August 2020


    I have this panel and 100% transparent UI buttons in world-space canvas, so they are not moving. The only thing that really matters is performance impact of collider based buttons and UI buttons

Sign In or Register to comment.