Object created through Instantiate does not update its position at the first frame

Hey all.

I have a small problem:

SomeObject o = Instantiate(object_prefab, spawnPosition, Quaternion.identity) as SomeObject;

It creates the object as supposed, but the problem is - it’s position is updated at the next frame. Basically the object is created at (0,0) position and in the next frame it is at “spawnPosition”.

I had this problem in the past many times with different scripts and also it does’t update rotation on first frame. Very frustrating. How to prevent it?

You could explicitly set the position:

  GameObject o = Instantiate(object_prefab) as GameObject;
  o.transform.position = spawnPosition;
  o.transform.rotation = Quaternion.identity; // Not so useful since already set by default