- Home /
Question by
Yurijh · Sep 06, 2020 at 12:33 PM ·
spriterenderer
How can I extract the average color from a SpriteRenderer?
I'd like to extract the average color from a SpriteRenderer with a certain Sprite loaded into. Can you suggest me some way to do it at runtime? Thank you!
Comment
Answer by orimoshe0123 · Sep 06, 2020 at 12:40 PM
There is a post about it in stackoverflow, here is the link.
The code basically take every pixel in the texture and sum the r values, g values, and b values of the texture.
Your answer
Follow this Question
Related Questions
How to swap a spriteRenderers source sprite at runtime when used by animator 0 Answers
Decreasing Alpha from object with Hp value 1 Answer
How Do I Smoothly Change The Color Of The SpriteRenderer Over Time? 1 Answer
Is there a way to change a Sprite's Rect at runtime? 0 Answers
Why can't the camera render the sprite? 2 Answers