Skip to content

Conversation

olatan
Copy link

@olatan olatan commented Jun 1, 2022

Added checkbox for using sorting group component.
To use, add a sortingGroup component to the same object containing the IsoSpriteSorting component.
Can likely be improved to support several hierarchies of sorting groups.

Added checkbox for using sorting group component.
To use, add a sortingGroup component to the same object containing the IsoSpriteSorting component.
Can likely be improved to support several hierarchies of sorting groups.
@olatan
Copy link
Author

olatan commented Jun 1, 2022

Quite new to github, apologies if I'm not doing this right!

@olatan
Copy link
Author

olatan commented Jun 1, 2022

Looks like there are a few bugs to sort out already. Perhaps we can figure it out together!

Copy link

@GameChecker4 GameChecker4 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cannot use sorting on SortingGroup without selecting any one SpriteRenderer - that throwing a error

Comment on lines +74 to 75

cachedBounds = new Bounds2D(renderersToSort[0].bounds);
Copy link

@GameChecker4 GameChecker4 Jun 15, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add to this a UseSortingGroup check, to use sorting groups without selecting SpriteRenderer (like the Particle System or Spine Animation mesh). That fixes the sorting sorting error, but a full fix requires a change in IsoSpriteSorting.CalculateBoundsIntersection() to compare the objects without bounds with other (return true is a quick fix. I think the real calculation of bounds for these objects can be tricky, and not always the right solution)

Suggested change
cachedBounds = new Bounds2D(renderersToSort[0].bounds);
if (!UseSortingGroup)
cachedBounds = new Bounds2D(renderersToSort[0].bounds);

@rskew
Copy link

rskew commented Aug 18, 2022

@olatan @GameChecker4 I've had a crack at fixing the issue with the bounds for game objects with multiple renderers, it might complement this PR #3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants