Strange Instantiate behaviour in 2017.1.1p2

I updated to 2017.1.1p2 yesterday and I’m seeing some weird behaviour with Instantiate. If I instantiate a prefab at a set location, when I check the location in Awake on a script attached to the prefab I get the wrong value. So:

GameObject.Instantiate(m_Prefab, new Vector3(123, 456, 789), Quaternion.identity);

Then in the prefab setup:

void Awake()
{
Debug.Log("Awake: " + transform.position);
}
void Start()
{
Debug.Log("Start: " + transform.position);
}

I get this:
Awake: (0.0, 0.0, 0.0)
Start: (123.0, 456.0, 789.0)

I have tried this in a fresh new project and it always happens. I came from 5.6.2p2 and I’ve checked 2017.1.0p5 and this works fine (same test project). Anyone else seeing this?

thanks

1 Like

Please file a bug report so we can investigate.

Happening to me too. Tested in 2017.1.1p3. Worked fine in 2017.1.0p4.

Might be related to this? https://issuetracker.unity3d.com/issues/game-object-transform-dot-position-is-incorrect-after-object-dot-instantiate-after-awake-function-call

Yeah I think this is from a fix we made recently. I know the change that caused it(it was me :(). A dev is looking Into it.

1 Like

Just checked it with 2017.1.2f1, still happens. Any idea on when a fix will be in? We spawn objects in Awake calls using position, so this is basically a show stopper for us.

It’s in the queue to go into the next patch release.

Great. Thanks Karl.

Does anybody know if this is fixed in 2017.1.2p1?

No the fix is not out yet. It got held back by some failing tests. I am hoping to have it in the next patch.

Thanks Karl!

I’ll ask again when p2 comes out :slight_smile:

  • David L

It seems this is still the issue even in 2017.2, even though the previously linked bugreport is marked as resolved?

I encountered it today after upgrading from 5.6 to 2017.2… In the place I am dealing with it it is sort of solvable by delaying the functionality to the Start method, but I must say it is not elegant/does feel very wrong, and I’m not sure what other scripts might suffer from it that are used somewhere further in the game where I did not yet test.

This is fixed in 2017.2.0p1+ https://unity3d.com/unity/qa/patch-releases?version=2017.2

1 Like

Any idea if this is going to be fixed in a 5.6.4 patch soon? It’s still broken in 5.6.4p4.

Its currently in the queue to go in. It should be in the 5.6.5 release

Thanks very much for the update Karl! :slight_smile:
Is there a timetable / known update window for 5.6.5?

Around the 15th December. Subject to change though if we find any issues during testing.

Fantastic, thanks for the info Karl. :slight_smile:

1 Like

Crossing my fingers. :slight_smile:

Any ETA on this fix/update? I’ve had a major content patch ready for a month, held up by this bug. I’m hoping to release it before the holiday sales.

Its currently undergoing testing. Eta 20th Dec – 22nd Dec.