Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

Bug New project with new input system giving method not found error.

Discussion in 'Input System' started by fragilequail_unity, Dec 18, 2022.

  1. fragilequail_unity

    fragilequail_unity

    Joined:
    Mar 24, 2022
    Posts:
    4
    I get the following error in unity with nearly a blank project.

    MissingMethodException: Method 'PlayerMovement.OnLook' not found.
    System.RuntimeType.InvokeMember (System.String name, System.Reflection.BindingFlags bindingFlags, System.Reflection.Binder binder, System.Object target, System.Object[] providedArgs, System.Reflection.ParameterModifier[] modifiers, System.Globalization.CultureInfo culture, System.String[] namedParams) (at <75633565436c42f0a6426b33f0132ade>:0)
    UnityEngine.SetupCoroutine.InvokeMember (System.Object behaviour, System.String name, System.Object variable) (at <4746c126b0b54f3b834845974d1a9190>:0)
    UnityEngine.InputSystem.LowLevel.<>c__DisplayClass10_0:<set_onBeforeUpdate>b__0(NativeInputUpdateType)
    UnityEngineInternal.Input.NativeInputSystem:NotifyBeforeUpdate(NativeInputUpdateType)


    This is all im trying to run currently and yet it suddenly started throwing a temper tantrum about OnLook not being found while it clearly exists in the menu. I've started a fresh project on the side and this error continues to present itself.

    Code (CSharp):
    1. using System.Collections;
    2. using System.Collections.Generic;
    3. using UnityEngine;
    4. using UnityEngine.InputSystem;
    5.  
    6. public class PlayerMovement : MonoBehaviour
    7. {
    8.     Rigidbody2D rb;
    9.     Vector2 moveValue;
    10.  
    11.     private void Awake()
    12.     {
    13.         //On awake we grab the main rigidbody component
    14.         rb = GetComponent<Rigidbody2D>();
    15.     }
    16.     void OnLook(InputAction.CallbackContext callback)
    17.     {
    18.         Debug.Log(callback.ReadValue<Vector2>().normalized);
    19.     }
    20. }
    Anyone know anything about this?

    The issue cropped up when I accidentally linked a project with an existing Plastics repository and overrode the project.
     
  2. fragilequail_unity

    fragilequail_unity

    Joined:
    Mar 24, 2022
    Posts:
    4
    Nevermind, I was doing it wrong.

    Code (CSharp):
    1. private void OnMove(InputValue value)
    2.     {
    3.         moveValue = value.Get<Vector2>();
    4.     }