2
\$\begingroup\$

In my 2D game, my circle shape for example, appears round, but when I change the color then it turns into a low poly circle with 8-16 points, more like a potato. Is there any way around this?

    myColor = new Color32 ((byte)colorR1, (byte)colorG2, (byte)colorB3, visibility);
    Color32 negativecolor = new Color32 ((byte)colorR1, (byte)colorG2, (byte)colorB3, (byte)(255-visibility));
    MaterialPropertyBlock props = new MaterialPropertyBlock ();
    props.SetColor ("_Color", myColor);
    rend.SetPropertyBlock (props);
    props.SetColor ("_Color", negativecolor);
    backchildrend.SetPropertyBlock (props);
\$\endgroup\$

closed as off-topic by DMGregory Oct 27 '18 at 12:19

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Questions about debugging a problem must provide a minimal, complete, verifiable example of the issue so that readers can diagnose it without needing to guess, read all of your code, or engage in extensive back-and-forth dialog. For more information, see this meta thread." – DMGregory
If this question can be reworded to fit the rules in the help center, please edit the question.

  • \$\begingroup\$ I'm not very familiar with this particular API, but my guess would be since you are newing the MaterialPropertyBlock, many of the settings are going to default. I'd suggest trying to manipulate the existing MPB from your shape (assuming that's possible). \$\endgroup\$ – Stephan Jul 23 '18 at 15:07
  • \$\begingroup\$ This sounds rather strange. If you're still struggling with this, can you show us a screenshot of the symptoms, and a snippet of the shader you're using to draw these sprites? \$\endgroup\$ – DMGregory Aug 27 '18 at 11:31
0
\$\begingroup\$

didn´t you try using the sprite renderer? That´s how I changed the colors of sprites. Use

SpriteRenderer sprite = GetComponent<SpriteRenderer>();
sprite.color = Color.red;

That should change the color of the whole sprite

\$\endgroup\$

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