Instantiate prefab, strange problem

Hi, i am making a network game and when a player join the world, the server tell the client to instantiate the prefab into a position in the world.

This work fine, when someone log in the model are shown at correct position.
The problem occur when i look at the new spawned model and then look away.
When i look back where the model have been, the model have changed position far far away.
The strange thing is that the model is there as long as i keep my camera view on it, but when its out of view it gets a new position (random) often very very far away.

Any idea what can cause this strange problem?
I instantiate using this code.


and i get the gameobject by using this code:

string temp = PrefabId.ToString();
PlayerModel =(GameObject)Resources.Load("PlayerPrefab/"+temp);

*Note: The position seems to be (at least the root ) the same but it’s rendered in a different position…

*Note: If you look at it again after first time and then look away, it get rendered in a new random location but the position on the transform in the same.

When I have a strange problem like this one, I ususaly start thowing “stuff” at it to see if I cannot narrow down what is going on. Here is a laundry list of things you might try for this issue:

  1. Look at all the positions and scales for the parent game object and all its children. Do any change between looking away and looking back?
  2. Change the shader for the material used in rendering the object.
  3. Disable any additional cameras in the scene.
  4. Examine the camera when looking away and then back. Do any settings change?
  5. Set the position of the new game object manually right after the object is created.
  6. Create a simple object in the editor (cube for example). Place this game object at or near the coordiantes you use when you Instantiate the prefab. Does it appear in the same place? Does it also move when you look away?
  7. Reset the position of the newly created game object half a second after creation to the position used when you Instantiated it.
  8. If your prefab is complex, try a very simple prefab in its place.
  9. Drag a copy of the prefab into the scene. Try Instantiating the scene copy instead of the copy you got using Resources.Load()

Good luck.