Search Issue Tracker

Won't Fix

Votes

0

Found in

2020.3.39f1

2021.3.9f1

2022.1.16f1

2022.2.0b7

2023.1.0a9

Issue ID

UUM-14673

Regression

No

Parenting rescales objects when using SetParent multiple times

--

-

Reproduction steps:
1. Download the project from Google Drive and open it
2. Connect Quest device with Oculus Air Link and Press the Play button in Editor to enter the Play Mode
3. Move the bottle from the left and place it on the middle blue object and then on the right blue object

Expected result: The bottle does not change the size
Actual result: The bottle shrinks

Reproducible with: 2023.1.0a9, 2022.2.0b7, 2022.1.16f1, 2021.3.9f1, 2020.3.39f1

Reproducible with devices:
VLNQA00379, Oculus (Quest 2), Android 10, CPU: Snapdragon XR2, GPU: Adreno (TM) 650

Reproduced on:
Windows 10 Pro 21H2

Notes:
- If Blender is not installed the bottles won’t be rendered in Editor and in build
- Using SetParent multiple times rescales objects
- Moving a bottle from left to the blue objects calls Magnet.cs where SetParent is invoked
- Reproduction video is uploaded in the original Jira incident case

  1. Resolution Note:

    Calling SetParent() will inherit any scale changes from the ancestors on your object.

    So either you need to make sure all ancestors have a local scale of (1,1,1) or use the SetParent() function with the argument worldPositionStays=true and manually adjust the position afterward. From the docs about worldPositionStays: "If true, the parent-relative position, scale, and rotation are modified such that the object keeps the same world space position, rotation, and scale as before."

    See the documentation here: https://docs.unity3d.com/ScriptReference/Transform.SetParent.html

Comments (1)

  1. EusebiuMarcu

    Oct 05, 2022 11:54

    With all due respect, this is a bug, so the Won't fix resolution is not OK.

    What you propose is a workaround that might not work in certain cases...

Add comment

Log in to post comment

All about bugs

View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.