Search Issue Tracker

Fixed in 2018.1

Fixed in 5.6, 2017.1, 2017.2, 2017.3

Votes

36

Found in

5.6.3p3

Issue ID

953068

Regression

Yes

Game object transform.position is incorrect after Object.Instantiate after Awake() function call

Scene Management

-

How to reproduce:
1. Download attached project files and open "test" Scene
2. Enter Play mode. Notice now the world-space location in Awake is printing the prefab location as opposed to the location passed to instantiate:
Parent(Clone): World-space location: (-10.0, 20.0, 0.0)
Child: World-space location: (-10.0, 20.0, 0.0)

Not reproduced:
1. Open project with Unity 5.6.3p2 and hit "play". Notice that "World-space location" printed in SpawnLog.Awake now outputs location as expected according to SpawnPrefab-script:
Parent(Clone): World-space location: (50.0, 100.0, 0.0)
Child: World-space location: (50.0, 100.0, 0.0)

Actual result: Instantiate(Prefab, new Vector3(50, 100, 0), Quaternion.identity) applies world position incorect in Debug.Log(transform.postion) after Awake() function call

Reproduced with: 5.6.3p4, 2017.1.1p3, 2017.2.0f1, 2017.3.0b2
Not reproduced with: 5.6.3p2, 2017.1f1, 2017.2.0b8, 2017.3.0a5
Regression since: 5.6.3p3
---------------------------------------------------------------------------------------
Fixed in 2017.1.2p3, 2017.2.0p1, 2017.3.0b5

  1. Response avatar

    karl_jones

    Jan 12, 2018

    The fix for this will be available in the following patches:
    5.6.5p1
    2017.1.2p3
    2017.2.0p1
    2017.3.0b5

Comments (43)

  1. 9bdc4a5a7a0199050356b2ae387f0fbb?d=mm

    Blackvz

    Jan 06, 2018 19:50

    Still not fixed in 2017.3.0f3 .........

    I will downgrade ........

  2. E2034f7753b52d221306edf828d6353e?d=mm

    Adam-VisualVocal

    Jan 03, 2018 19:54

    I am also seeing this in 2017.3.0f3. The workaround in my case was to call SetPositionAndRotation on the newly instantiated object. Setting the prefab transform prior to calling Instantiate did not work for me.

  3. C48b1a8184c3d5cf7600248a342b6cd6?d=mm

    MalteJoeFrid

    Jan 03, 2018 15:00

    Still not fixed. Our whole project is stalled dead because of this error.

  4. 5bea8535f26b570ac592f267db64f554?d=mm

    Fowi

    Dec 29, 2017 03:34

    Error. Not resolved yet. I am using 2017.3.0f3.
    Important error!!!

  5. F1b5e9fd97c16c095fff3301ef101cc8?d=mm

    Damjan-Mozetic

    Dec 27, 2017 07:19

    NOT resolved. Still happening to me in 2017.3.0f3. Unless I put a delay in, setting a transform position on an Instantiate-d game object does not work.

  6. Ac2b2ceaa31183dfec99d62e76efc0b8?d=mm

    DoctorMobius

    Dec 24, 2017 17:58

    Same behaviour using 2017.3.0f3 and trying to add buttons to a canvas using:
    GameObject button = Instantiate (buttonPrefab, canvas.transform.position + buttonOffset, Quaternion.identity, canvas.transform);

    However doing the same thing over two lines works:
    GameObject button = Instantiate (buttonPrefab, canvas.transform);
    button.transform.position = canvas.transform.position + buttonOffset;

  7. 4ddf1712f1875fef9322f0aa1fe768dd?d=mm

    TurgutHakki

    Dec 22, 2017 09:44

    NOT fixed. Still happening in 2017.3.0f3

  8. 0e34cac96faf280850d9858607c3c57e?d=mm

    shadiradio

    Dec 14, 2017 18:07

    @manutoo - Definitely, that's what I was intending to do. However I spoke too soon - this is also broken over the network, so NetworkServer.Spawn(...) won't spawn remotely registered prefabs in the fixed server-location, but in the broken local client prefab location. Rather than refactor all of my instantiation code, I'll wait for Unity's fix. Apparently it may be in an update tomorrow (5.6.5) according to a developer on the forums.

  9. 6fb4d2637ba838becc92cc9bead52f96?d=mm

    manutoo

    Dec 14, 2017 12:56

    @shadiradio,
    possibly, you can backup all your prefab values at game start (or on 1st instantiation), and then restore the values on game exit (or simpler, only reset all prefab positions & rotations to 0 on game exit), so version control won't get too ugly... :)

  10. 0e34cac96faf280850d9858607c3c57e?d=mm

    shadiradio

    Dec 13, 2017 23:41

    @manutoo - Thanks again, it does work. It's pretty ugly with version control (as every single prefab is touched/modified), especially since I use a prefab object pooler for a lot of FX. But at least it's playable again.

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.