Search Unity

change color of 2d clothes

Discussion in '2D' started by dccoo, Oct 10, 2015.

  1. dccoo

    dccoo

    Joined:
    Oct 3, 2015
    Posts:
    161
    suppose I have my 2d player and he has equipments, like boots, shirts, etc.
    I'd like to change the color of those clothes anytime I change them for new ones.
    is it possible to change their color?
    pseudo-code of what I want:

    if (new_equipment == 3){ actual_equipment.changeToColor( R, G, B ); }

    for example, I'm using red shirt and I change to blue jacket, then the shirt goes to blue.
    thanks
     
  2. luniac

    luniac

    Joined:
    Jan 12, 2011
    Posts:
    614
    is the red shirt and blue jacket the same sprite?
    cause then you just do it to that sprite, you just have to store somewhere the color that the blue jacket represents and retrieve it when you change to "blue jacket"
     
  3. dccoo

    dccoo

    Joined:
    Oct 3, 2015
    Posts:
    161
    but how do I apply the color on it?
     
  4. luniac

    luniac

    Joined:
    Jan 12, 2011
    Posts:
    614
    look in the unity scripting documentation for "color", all the information is there most of the time. Get used to checking it, i do all the time.