# Why does transform.forward appear to be void?

I have the following line of code from a project I'm working on:

this.transform.position += (keyMapping.Value * this.movementSpeed).Scale(this.transform.forward);


At a first glance, this line of code looks like it should work, yet, I get the following error when I try to run it:

error CS0019: Operator +=' cannot be applied to operands of type UnityEngine.Vector3' and void'.


I'm stumped as to what might be causing this. How do I fix this?

• Please note that, this keyword will refer to current instance of the "class" you are working on, which is a script. In your case, the code will work but you should use gameObject to refer the instance of GameObject you are working on. And you can use transform directly to refer the Transform assigned to the GameObject you are working on. – S. Tarık Çetin Jan 2 '16 at 22:17

Vector3.Scale with one parameter input does not return a value so you will need to apply Scale as a separate step.
var movement = (keyMapping.Value * this.movementSpeed);
`