Having a very strange problem, here.
I’m creating an object via Object.Instantiate(prefab)
, and I’m unable to change it’s position until about 10 seconds have passed, whether by setting transform.position
or just trying to move it around in the Scene editor.
The code I’m using is just
Transform cross = Object.Instantiate(crossPrefab) as Transform;
cross.position = new Vector3(8, 0, 0);
Debug.Log(cross.position);
The log traces (8, 0, 0) as you’d expect, but if I trace the cross’s position on the next frame, it’ll show (0, 0, 0) again. It’s like there’s a script that’s resetting the object’s position to (0, 0, 0) every frame, although that’s certainly not happening in any of the scripts I’m using. (I’m just starting a new project, there’s only a few dozen LOC to check).
Setting rotation also doesn’t work.
And after around ten seconds have passed since instantiation, I can manipulate the transform in code or in the editor without any problems. Instantiating another object will mean I have to wait another ten seconds until the second object can be moved around, while the first one still moves fine.
If it’s relevant, if I parent the newly-instantiated object to an existing transform, and move that parent transform, it works okay. It’s just the local transforms of newly-instantiated objects.
The prefabs I’m instantiating are just empty objects with a model attached, with no extra scripting at all. The model is imported from Blender (straight from a .blend file).
Is there anything that might be causing this? I feel like I must be missing something obvious.