sort in ascending order the gameobjects of an array,
Good afternoon!
W#
A problem with using Linq to sort with OrderBy, if you have more than 9 objects, say 1,2,3,4,5,6,7,8,9,10, Linq will classify them as 1,10, 2, 3,4,5,6,7,8,9, which probably is not the want.
What's the fix for that? Follow the Code:
Public GameObject [] route;
void Field () {
route = GameObject.FindeGameObjectWithTag ("direction"). OrderBy (go => go.name) ToArray (); ,Good afternoon!
W#
A problem with using Linq to sort with OrderBy, if you have more than 9 objects, say 1,2,3,4,5,6,7,8,9,10, Linq will classify them as 1,10, 2, 3,4,5,6,7,8,9, which probably is not the want.
What's the fix for that? Follow the Code:
Public GameObject [] route;
void Field () {
route = GameObject.FindeGameObjectWithTag ("direction"). OrderBy (go => go.name) ToArray ();
}
Your answer
Follow this Question
Related Questions
Storing a Gameobject from array into a Gameobject variable giving NullReferenceException 3 Answers
How do i put an object in an array that's attached to a prefab? 0 Answers
Using an Array to Disable Objects (each from different places in the heirarchy) 0 Answers