DemoProductions / shmup

3 stars 2 forks source link

Improve speed of TrackingAI #54

Open flip40 opened 8 years ago

flip40 commented 8 years ago

TrackingAI has a lot of GetComponent calls on Team, however I believe we could fix the piece where I grab all the GameObjects out of the Team scripts I find in Start, and instead just keep the list of Team. These scripts keep the GameObject as a variable, so it should be far faster to be grabbing the transform directly from the Team objects, instead of converting them to a GameObject and then finding their Team component again later.

Arguably having a List<Team> targets looks odd compared to List<GameObject> targets, but at the end of the day the speed is definitely worth a small appearance that really isn't that big of a deal.

Unless we really hit some speed bumps though, this is not a big deal. Just noting this.