Hi
little issue regarding color tween.
I created a panel that contains a button with a UIButton script component. The panel also contains a component that programmatically change the status of the button based on some conditions.
The first time the panel become active all works as expected and the button state is "disabled" (color changed and collider is not active).
However, if I disable the panel and the re-enable it again, the button doesn't change color.
public bool isEnabled
{
get
{
Collider col = collider;
return col && col.enabled;
}
set
{
Collider col = collider;
if (!col) return;
[b]if (col.enabled != value)[/b]
{
col.enabled = value;
UpdateColor(value, false);
}
}
}
The condition if (col.enabled != value) always fails because the collider state is not changed (the state still is not enabled after the panel has been activate again) so the color transform is not triggered.
I can change the code and remove that condition but It is not what I would like to do. Alternatively I can change the collider state to enable first and then invoke the isEnabled method. A bit tricky to be honest.
Alternative ?
Thank
Cristian