Can any one please tell me why I am getting this error In my code please ?
CS1612: Cannot modify a value type return value of `UnityEngine.Transform.position’. Consider storing the value in a temporary variable
It is showing for this line of code .
player01.position.x = mainCam.ScreenToWorldPoint (new Vector3 (75f, 0f, 0f)).x;
This is because you are setting Transform.position.x.
position is a Vector3. A Vector3 is a struct. A struct is a value type (a class is a reference type).
When you call transform.position you get a copy of the Vector3 value instead of a reference to the value (See @fafase his comment for why you get a copy), for instance: [0,0,0]. This means that this copy that you get is not linked to the transform anymore, and setting the x of a copy of a value which isn’t used anywhere is pointless, therefore the exception.
To fix this, simply follow the advise of the exception.