I got an error but I still able to move my player

InvalidOperationException: You are trying to read Input using the UnityEngine.Input class, but you have switched active Input handling to Input System package in Player Settings.
UnityEngine.Input.get_mousePosition () (at <5c58e879432d4bbc92c7a52441ed9480>:0)

Why did I get this msg when I run the game
I checked everything even in the project settings
It says you have switched Input handling to " Input System Package ". The Input manager will not be used.

Hi,

Which version of Unity do you use? And which Input System Package did you select in the project settings? Also please share the concerning line of code.

using System.Collections;

using System.Collections.Generic;

using UnityEngine;

using UnityEngine.InputSystem;

public class Player : MonoBehaviour

{

[SerializeField]float moveSpeed = 0.5f;

[SerializeField]float paddingLeft;

[SerializeField]float paddingRight;

[SerializeField]float paddingTop;

[SerializeField]float paddingBottom;

 Vector2 rawInput;

 Vector2 minBounds;

 Vector2 maxBounds;

 void Start()

{

    InsideBounds();

}  

void Update()

{

    Move();

}

void InsideBounds()

{

    Camera mainCamera = Camera.main;

    minBounds = mainCamera.ViewportToWorldPoint(new Vector2(0,0));

    maxBounds = mainCamera.ViewportToWorldPoint(new Vector2(1,1));

}

void Move()

{  

    Vector3 delta = rawInput * moveSpeed * Time.deltaTime;

    Vector2 newPos = new Vector2();

    newPos.x = Mathf.Clamp(transform.position.x + delta.x , minBounds.x + paddingLeft, maxBounds .x + paddingRight);

    newPos.y = Mathf.Clamp(transform.position.y + delta.y , minBounds.y + paddingBottom, maxBounds .y + paddingTop);

    transform.position = newPos;

}

void OnMove(InputValue value)

    {

        rawInput = value.Get<Vector2>();

    }

}

2021.3.1f1 The moment I started this course unity got a new version , so I switched back from 2021.3.2f1 to 1f1

Please try what was suggested here.

Pfinnn’s answer in the same thread might also be relevant. Make sure the Project Settings > Player > Input System is set to the new Input System.

I solved it !!!
I changed Project Settings > Player > Active Input Handling to old one and after restart the engine I switched it back again to the new one and Errors are gone now.
Thank You for your time Nina !

Good job! :slight_smile:

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.