1
\$\begingroup\$

I'm making a stickman 2D game where I have different sprites for the player.

But when I try to change the Sprite Renderer Color, it only changes few pixels of the sprite and the rest stays black as in the original sprite.

What am I missing?

\$\endgroup\$
  • \$\begingroup\$ Unfortunately there's not enough information for an answer to this question. Could you provide some more details? What engine/framework are you using? What language? How are you changing the colour? Some pictures would be useful, as knowing which pixels are painted could identify the issue faster. \$\endgroup\$ – TomTsagk Dec 11 '18 at 17:49
  • \$\begingroup\$ It's Unity. Sorry, I should have specified that. However, got my answer :) \$\endgroup\$ – ddd555 Dec 11 '18 at 18:36
2
\$\begingroup\$

You've mentioned that the rest of your pixels stay black. The way SpriteRenderer.Color is applied is via multiplication. The mentioned color field does not replace the pixel color but "tints" it. So if you have many black pixels in your sprite, they won't be affected because no matter what color you multiply black (0, 0, 0, 1) by it will remain black.

\$\endgroup\$
  • \$\begingroup\$ Oh, that makes sense, thank you! So that was what I was missing. If I edit my sprites and make them white, then it should work with the absolute colours I assume? \$\endgroup\$ – ddd555 Dec 11 '18 at 18:33
  • \$\begingroup\$ Yup, white will have the most pronounced effect. \$\endgroup\$ – mt_ Dec 11 '18 at 18:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.