- Home /
 
Assets\PlayerController.cs(29,29): error CS0200: Property or indexer 'Vector3.normalized' cannot be assigned to -- it is read only
I am rather new to coding and i was trying to code a game in unity. I was watching a video to see exactly how to do it and i did exactly what was shown in the video but i still got this error message:
Assets\PlayerController.cs(29,29): error CS0200: Property or indexer 'Vector3.normalized' cannot be assigned to -- it is read only
I tried tons of different things like changing the wording and completely removing it but nothing seemed to work. Here is the code:
 using System;
 using System.Collections.Specialized;
 using System.Security.Cryptography;
 using UnityEngine;
 
 [RequireComponent(typeof(PlayerMotor))]
 public class PlayerController : MonoBehaviour {
 
     [SerializeField]
     private float speed = 5f;
 
     private PlayerMotor motor;
 
     void Start ()
     {
         motor = GetComponent<PlayerMotor>();
     }
 
     void Update ()
     {
         //Calculate movement velocity as a 3D vector
         float _xMov = Input.GetAxisRaw("Horizontal");
         float _zMov = Input.GetAxisRaw("Vertical");
 
         Vector3 _movHorizontal = transform.right * _xMov;
         Vector3 _movVertical = transform.forward * _zMov;
 
         //Final movement vector
         Vector3 _velocity = (_movHorizontal + _movVertical).normalized = speed;
 
         //Apply movement
         motor.Move(_velocity);
 
     }
 
 }
 
               If you spot any other possible errors then please let me know.
Answer by bgoldbeck · Aug 05, 2020 at 02:54 AM
You have two assignment operators, I think you mean
 Vector3 _velocity = (_movHorizontal + _movVertical).normalized * speed;
 
 
              Your answer
 
             Follow this Question
Related Questions
I have an error "MissingReferenceException" and i dont know why 1 Answer
Errors i can't understand. SetSystemInterested 1 Answer
movement not working,movement controller not working 0 Answers
Error While Build APK Signed,Error while build APK Signed. 0 Answers
"Assertion failed: Error querying default thread scheduling params: 3" 0 Answers