Hello Guest

Author Topic: Changing color of tk2dSprite and tk2dTextMesh not working  (Read 4475 times)

ioker

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 4
    • View Profile
Changing color of tk2dSprite and tk2dTextMesh not working
« on: June 25, 2014, 09:18:19 am »
Hi everyone,

I have this class:

Code: [Select]
using UnityEngine;
using System.Collections;

public class TestClass : MonoBehaviour {
public tk2dSprite sprite;
public tk2dTextMesh text;

public void configure (Color color) {
sprite.color = color;
text.color = color;
text.Commit();
}
}

But none of the two elements changes the color that I set. What it's wrong in this class?

Thanks in advance.

ioker

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 4
    • View Profile
Re: Changing color of tk2dSprite and tk2dTextMesh not working
« Reply #1 on: June 25, 2014, 09:29:59 am »
Ok. I found the solution. I need to use Color32, not Color.

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: Changing color of tk2dSprite and tk2dTextMesh not working
« Reply #2 on: June 25, 2014, 10:13:42 pm »
That isn't the solution. I"m guessing you created a Color(255, 192, 150, 255) ? The range for the rgb values with a Color class is 0..1, its 0..255 with Color32, which is why it seemed to fix it.