Search Unity

Error color render & prefabs size

Discussion in '2D' started by Kei-kun, Jun 23, 2021.

  1. Kei-kun

    Kei-kun

    Joined:
    Jun 13, 2021
    Posts:
    3
    Hi everyone! Here is images when testing on unity and on android. I use grayscale color for pixel prefab, Color Swatches prefabs are objects Institate with code. Why is there this difference? Hope everybody can help please, thanks a lot.

    Sorry my english is pretty bad.:(

    upload_2021-6-23_16-45-8.png upload_2021-6-23_16-46-32.png
     
  2. Kei-kun

    Kei-kun

    Joined:
    Jun 13, 2021
    Posts:
    3
    help me pls
     
  3. Kei-kun

    Kei-kun

    Joined:
    Jun 13, 2021
    Posts:
    3
    Thank you very much!

    But some pixel objects are black. What's the reason? upload_2021-6-24_22-11-9.png

    Here is my code:
    Code (CSharp):
    1.  
    2.         ID = colorID;
    3.         PixelColor = color;
    4.         GrayColor = Color.Lerp(new Color(PixelColor.grayscale, PixelColor.grayscale, PixelColor.grayscale), Color.white, 0.6f);
    5.         SelectColor = Color.Lerp(new Color(PixelColor.grayscale, PixelColor.grayscale, PixelColor.grayscale), Color.white, 0.4f);
    6.  
    7.         Text.text = colorID.ToString();
    8.         Border.color = Color.black;
    9.         Background.material.SetColor("_Color", GrayColor);
    Here is Pixel Prefabs: