Skip to content

UNT0022 changes behavior if transform is used in rotation update #428

@mrooney

Description

@mrooney

Hi there, it seems like UNT0022 is changing behavior and I'm wondering if this is true and if there is a way to avoid it.

To Reproduce

transform.position = Target.position + GetComputedOffset();
transform.rotation = Quaternion.LookRotation(Target.position - transform.position, Vector3.up);

Expected behavior

Nothing should be reported, because the rotation change uses the transform.position, and putting it inside SetPositionAndRotation will now cause it to use the old transform.position instead of the new one.

Actual behavior

transform.SetPositionAndRotation(Target.position + GetComputedOffset(), Quaternion.LookRotation(Target.position - transform.position, Vector3.up));

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions