Forum rules - please read before posting.

How to sort overlapping hotspots?

Hi

I have many instances where 2 hotspots are overlapping to some extent and where I want them both active at the same time.
I know the simple solution would be to have 2 hotspots for each object and turn the on/off as needed so they mix well, but this is not a practical solution for me in the long run.
I would like to be able to assign something like sorting levels to the hotspots, so one takes precedence over the other with regards to mouse-overs.
I tried using the transform position z axis for this, but it has no effect.
Is there any way to achieve this?

Comments

  • This is for a 2D game?

    If two 2D colliders occupy the same space, then their relative Z-positions should be the deciding factor - with the one closer to the camera "winning" in mouse-over raycasts.

    Though, it's safest to just avoid overlapping when possible. Be aware that you're not limited to Box Collider 2D compoents - if your Hotspot has a complex shape, you can instead rely on a Polygon Collider 2D component.

  • Hi
    And the Z-position does work.
    I just forgot to take into consideration that my game camera was set at Z-position -5.
    Foolish me :-)

Sign In or Register to comment.

Howdy, Stranger!

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

Welcome to the official forum for Adventure Creator.