Do scripts get cloned with prefabs?

Hello, a strange one:

I have a prefab ‘Car’ (just a Cube in fact) with a simple Motor script attached:

function Update(){

transform.Translate(Vector3.forward * Thrust * Time.deltaTime);

}

With one copy of the prefab in the scene, it works as expected. However with 2 or more, I noticed that apparently neither object was moving. By looking in Scene view at runtime I could in fact see that the transforms are moving (the local origin orthogonal axes move around the screen) but somehow the Cube meshes are being left in their original positions.

Any clues at all about what this could be?

When prefabs are cloned, their scripts (and internal references to transform, gameObject etc.) are cloned and updated too right?

Yes, you should get the scripts as well when Instantiating another object of the same type. Can you post your Cloning/Instantiate function? Are you perhaps getting the wrong object in the Hierarchy?

I havnt encountered this peculiar problem you are facing.

But as a work around i would suggest you create an empty gameobject attach the character motor script you are using to the empty and then child the car mesh you are using under the empty. you can rename the empty and create a prefab from it.

this way the mesh will be moved since the parent gameobject is being moved.

idealy you should be instantiating the prefabs from script, which has always worked well for me.