Demigiant Forum
Unity Assets => DOTween & DOTween Pro => Topic started by: vi54 on February 01, 2016, 09:46:10 PM
-
HI
I have a camera FX script with a few public variables.
I call these from a different gameObject, and make a (working) connection as I can enable / disable the component. Thus knowing it has a good reference.
However. When I try to tween the float value 'intensity" on the script it does not tween.
other tweens in the same script does work.
for example a text tween: GM.ScoreText.DOText ("Score_" + GM.currentScore, 2f, false, ScrambleMode.None, null);
This tween however does not work.
WaterEffectScript WaterFX;
void Start(){
WaterFX.enabled = false;
WaterFX.Intensity = 0.66f;
WaterFX = Camera.main.GetComponent<WaterEffectScript>();
}
public void OnTriggerEnter2D(Collider2D other){
if (other.gameObject.tag == "Player") {
WaterFX.enable = true; //works
GM.ScoreText.DOText ("Score_" + GM.currentScore, 2f, false, ScrambleMode.None, null);//works
DOTween.To (() => WaterFX.Intensity, x => WaterFX.Intensity = x, 0,2f).OnComplete(DisableFX); //doesn't tween
}
}
Thanks for your insight.
-
Hi!
Your code seems absolutely legit, so the only reason that property might not be tweened should be one of these:
1) You're resetting it every frame somewhere
2) You're resetting the tween every frame somewhere
3) Something else is controlling the Intensity value
Let me know, and cheers,
Daniele
-
Thanks Daniele.
So far I haven't been able to figure it out.
Alas I don't have the time to examine this further, but when I can i'll post my findings here (regardless if they are embarrassing or not) :)
All the best
-
Aha thanks! :)