How do I simplify the following linq query so that I am only doing one GetComponent call instead of two?
units = GameObject.FindGameObjectsWithTag(“enemy”).OrderByDescending(x => x.GetComponent().Initiative).Select(x => x.GetComponent()).ToArray();
I’d like to be able to select each Unit and then sort the list by its initiative.
Great, thanks!
– Luluandfriends