#unity 2021 collision 2D on ui not working

1 messages · Page 1 of 1 (latest)

trim falcon
arctic kindle
#

blobnotlikethis
UI does not work in the same way as other scene objects.
2D and 3D objects are not supposed to be placed on UI, and collisions do not work on UI either because of how differently it is treated.
That is also the reason IPointer...Handler interfaces exist for UI interactions.

trim falcon
#

how do I detect collision with ui elements then? trying to create a hacking mini game to unlock doors etc

#

@arctic kindle

arctic kindle
#

collisions, as in "UI elements colliding with one another" or as in "being clicked on"?

trim falcon
#

UI elements colliding because the player will need to press space and hit the target when it lands onto it like pop the lock

arctic kindle
#

Well... you don't. UI is meant as just that - an interface. It is not meant to house game mechanics that require physics interactions.
You can either try to emulate collision behaviour manually, or create the minigame as a 2D/3D scene and use a render texture to show it on UI.

trim falcon
#

so ill need to make a 2d scene and splice it with the 3d scene and use a render matrail to display the mini game ?

arctic kindle
#

*render texture

And you can just load the minigame scene additively when it's needed, that way you won't need to combine them.

trim falcon
#

thank you so much (;