Cs. (9,38): error CS1525: Unexpected symbol "=".

I tried everything, I can not solve it.

using UnityEngine; public class Moveplayer : MonoBehaviour { public Transform player; private void OnMouseDrag() { Vector3 MousePos = Camera.main.ScreenToWorldPoint(Input.mousePosition); player.position = new Vector2 = (MousePos.x. player.position.y); } } 

Closed due to the fact that off-topic participants are Andrew NOP , EvgeniyZ , AK , 0xdb , user300000 11 Oct '18 at 9:21 .

It seems that this question does not correspond to the subject of the site. Those who voted to close it indicated the following reason:

  • "The question is caused by a problem that is no longer reproduced or typed . Although similar questions may be relevant on this site, solving this question is unlikely to help future visitors. You can usually avoid similar questions by writing and researching a minimum program to reproduce the problem before publishing the question. " - Andrey NOP, EvgeniyZ, AK, 0xdb, Let's say Pie
If the question can be reformulated according to the rules set out in the certificate , edit it .

    1 answer 1

     player.position = new Vector2(MousePos.x, MousPos.y); 

    https://docs.unity3d.com/ScriptReference/Vector2-ctor.html