cakeslice / Outline-Effect

Outline Image Effect for Unity
MIT License
1.48k stars 201 forks source link

Added Singleton. Reduced usage of GetComponent. #16

Closed NikkiWitch closed 7 years ago

NikkiWitch commented 7 years ago

Hey Caki!

First of all I love your asset! I have no clue of how shader works, so thank you very much! Since I make a game for mobile devices performance is everything. Adding outlines is very expensive. So to get a little bit better performance I've reduced the calls to GetComponent, this is a relatively expensive operation (https://snowhydra.wordpress.com/2015/06/01/unity-performance-testing-getcomponent-fields-tags/). In addition, I changed the OutlineEffect class to a singleton so we don't have to GetComponent for each object. Garbage collection is also something we should be careful with.

So, merge if you like! :)

NikkiWitch

cakeslice commented 7 years ago

Hello,

I had no clue GetComponent had a perf hit so thanks, will merge!