2D Toolkit Forum

2D Toolkit => Support => Topic started by: ioker on June 25, 2014, 09:18:19 am

Title: Changing color of tk2dSprite and tk2dTextMesh not working
Post by: ioker 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.
Title: Re: Changing color of tk2dSprite and tk2dTextMesh not working
Post by: ioker on June 25, 2014, 09:29:59 am
Ok. I found the solution. I need to use Color32, not Color.
Title: Re: Changing color of tk2dSprite and tk2dTextMesh not working
Post by: unikronsoftware 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.