dentedpixel / LeanTween

LeanTween is an efficient animation engine for Unity
608 stars 135 forks source link

Rotation and Value Tween stopping even when no cancel called #178

Closed MichaelUnity3d closed 1 year ago

MichaelUnity3d commented 1 year ago

Hi!

I was hoping someone may be able to help.

I have one game object with a continuous rotation using RotateY and RotateZ, also utilising LeanTween.Value for updating a value continuously. Basic cube continuously rotating on the Z and Y axis, and the value is Tweening a material/shader float value.

All 3 tweens have their own id value assigned as well to separate from any other Tween calls or Cancel calls.

Strange occurrence that when a Tween stops on another unconnected gameObject/script (all with their own id's and values), it stops the Tween on the other GameObject.

All Cancel calls on the other game object reference the gameobject and the id.

Rotating Cube Script GameObject (functions called from Start) private void RotateObject() { idRotateZ = LeanTween.rotateZ(gameObject, (gameObject.transform.eulerAngles.z + 180), rotSpeed).id; idRotateY = LeanTween.rotateY(gameObject, (gameObject.transform.eulerAngles.y + 180), rotSpeed).setOnComplete(RotateObject).id; }

private void OutlineFlux()
{
    idFlux = LeanTween.value(gameObject, 1.01f, 1.1f, fluxSpeed).setOnUpdate(UpdateMaterialFlux).setLoopPingPong(-1).id;
}
private void UpdateMaterialFlux(float flux)
{
    skullCube.GetComponent<MeshRenderer>().materials[1].SetFloat("_outlineThickness",flux);
}

HUD Update Script (seperate game object unconnected) public void HUDCandleActiveOff() { LeanTween.cancel(gameObject,idSymbolHolder); LeanTween.cancel(gameObject,idSymbolGlow); LeanTween.cancel(gameObject,idCandleBar);

    idSymbolHolder = LeanTween.alpha(symbolHolder.rectTransform, 0.1f, 0f).id;
    idSymbolHolder = LeanTween.scale(symbolHolder.rectTransform, Vector3.one, 0f).id;

    symbolGlow.enabled = false;
    idSymbolGlow = LeanTween.alpha(symbolGlow.rectTransform, 0.5f, 0f).id;

    idCandleBar = LeanTween.alpha(candleBar.rectTransform, 0.7f, 0f).id;
}

Whenever an end function is called on the other gameobject, it seems to cancel out the continuous rotating cube? Chances are its me, but not had any other problems until applying a continuous tween. Am missing something?

Any help would be much appreciated.

MichaelUnity3d commented 1 year ago

Just to add these are the only tween calls happening at the time of the object stopping rotating and the value being updated.