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. Dismiss Notice

Question I have 2 scripts, both use the enter key. How do I let the enter key in one script take precedence?

Discussion in 'Getting Started' started by keumasou, Jul 15, 2023.

  1. keumasou

    keumasou

    Joined:
    Jul 8, 2023
    Posts:
    1
    Title, I have script A and B. Script A calls script B to use the enter key for something, but it triggers the thing that the enter key is set for in A. How do I fix this?
     
  2. tleylan

    tleylan

    Joined:
    Jun 17, 2020
    Posts:
    521
    If Script B is never actually supposed to recognize the enter key then it shouldn't be watching for it. You should be able to add a method that processes whatever it is you need and have Script A call it when it recognizes the enter key.
     
    Chubzdoomer likes this.