Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Changing sprite color with sciprts

Discussion in '2D' started by Spacejaw, Apr 17, 2014.

  1. Spacejaw

    Spacejaw

    Joined:
    Apr 7, 2014
    Posts:
    4
    Hi. I have a problem with changing color of character sprite using scripts. All works well in sprite editor, but when I'm trying to do that with script, my character just disappears. Is that unity bug or my mistake?
     
  2. mgear

    mgear

    Joined:
    Aug 3, 2010
    Posts:
    8,936
    Can you show that part of the script?
     
  3. ELISAN

    ELISAN

    Joined:
    Mar 31, 2012
    Posts:
    20
    var ThisColor : Vector4;
    SpriteRenderer.color = ThisColor;
     
  4. Spacejaw

    Spacejaw

    Joined:
    Apr 7, 2014
    Posts:
    4
    Thanks. Didn't notice 0 in alpha channel.
     
  5. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,398
    You mean Color, not Vector4.

    --Eric