Hello Guest

Author Topic: Selecting from overlapping sprites  (Read 3444 times)

jrhee

  • Newbie
  • *
  • Posts: 10
    • View Profile
Selecting from overlapping sprites
« on: February 06, 2014, 03:40:36 am »
Hi,

I've been running into issues with selecting the correct sprite out of overlapping groups of sprites, especially since my sprite bounds are fairly large due to my process for aligning them, and layer/sorting layer locking isn't supported at this point. Any chance there's a way to switch sprite selection in the scene view to be based on the render mesh (or at least trimmed bounds) rather than the main sprite bounds?

If not, is there a recommended way to correctly select from occluded sprites (apart from the scene hierarchy)? Ideally it would be nice if objects were only selected if there's a non-zero alpha at the clicked location, or there were some sort of mechanism to cycle through overlapping sprites (i.e. alt click to select next object behind) :)

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: Selecting from overlapping sprites
« Reply #1 on: February 06, 2014, 09:12:38 am »
You can change it to simply use the bounding box easily enough. In tk2dSprite.OnDrawGizmos, change 2 occurrences of untrimmedBoundsData to boundsData. Or you can comment out that function entirely and rely on Unitys picking (won't work with flipped sprites).

Its not possible to cycle through overlapping sprites or zero alpha, the required functionality isn't exposed in Unity :(

jrhee

  • Newbie
  • *
  • Posts: 10
    • View Profile
Re: Selecting from overlapping sprites
« Reply #2 on: February 09, 2014, 04:56:01 pm »
Got it, thanks for the pointer!