Never hurts to read the comments :) props to the original author.
// Sort by position.
// Note: Get the children from left to right.
// We would need to add a few conditions to handle
// all the possible scrolling directions.
if (direction.x < 0)
{
backgroundPart = backgroundPart.OrderBy(
t => t.position.x
).ToList();
}
else
{
backgroundPart = backgroundPart.OrderByDescending(
t => t.position.x
).ToList();
}
↧