When cloning, how do you make your clones keep the original properties?

Hello,

I am trying to clone an object, and I want the clone to have the same velocity as the original object, but every time I try, the clone is not keeping the original velocity. How can I solve this?

Thank you for your responses!

Instantiate copies what it copies, and you can’t change that. Pretty much, the stuff you can’t see in the Inspector isn’t copied by Instantiate – dynamic physics settings and private script variables.

But, you can easily just copy over the values yourself, after the Instantiate.

Have you considered attaching a script directly to the mouse object’s prefab which sets is velocity as soon as its spawned?

private Rigidbody rb; // Reference to the rigidbody void Start () { rb = GetComponent &ltRigidbody&gt (); // Sets up the rigidbody reference rb.velocity = new Vector3 (0f, 10f, 0f); // Sets the objects velocity on creation } }

The alternative is to make sure you get the rigidbody component on every object you spawn.

Add

tempRigidbody = clone.GetComponent &ltRigidbody&gt(); tempRigidbody.velocity = new Vector3 (0, 10, 0);

into your instantiate function and it should work.