Skip to content

Check warnEndValueEqualsCurrent before vector comparison #229

@cfoulston

Description

@cfoulston

Something I noticed in the code. If warnEndValueEqualsCurrent is false, the vector is still compared.

if (d.startValue.vector4 == endValueOrDiff.vector4 && d.warnEndValueEqualsCurrent && !shakeData.isAlive) {
    Assert.LogWarningWithStackTrace($"Tween's 'endValue' equals to the current animated value: {d.startValue.vector4}, tween: {GetDescription()}.\n" +
                      $"{Constants.buildWarningCanBeDisabledMessage(nameof(PrimeTweenConfig.warnEndValueEqualsCurrent))}\n", id, target);
}

Vector comparison should be the last thing evaluated:

if (d.warnEndValueEqualsCurrent && !shakeData.isAlive && d.startValue.vector4 == endValueOrDiff.vector4) {
    Assert.LogWarningWithStackTrace($"Tween's 'endValue' equals to the current animated value: {d.startValue.vector4}, tween: {GetDescription()}.\n" +
                      $"{Constants.buildWarningCanBeDisabledMessage(nameof(PrimeTweenConfig.warnEndValueEqualsCurrent))}\n", id, target);
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions