Converting unity script to c#: collision.rigidbody.velocity.x = ...

Hi,

I’m having problems converting this command to c#:
collision.rigidbody.velocity.x = (collision.transform.position.x - transform.position.x)*8;

I get the following error in c#:
Assets/Scripts/Player.cs(38,37): error CS1612: Cannot modify a value type return value of `UnityEngine.Rigidbody.velocity’. Consider storing the value in a temporary variable

Thanks in advance for any help.

ok figured it out:

Vector3 test = collision.rigidbody.velocity;
test.x = (collision.transform.position.x - transform.position.x)*8;

that’s all.