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

Moving with keyboard arrows c#

Discussion in '2D' started by Alekaz, Dec 6, 2020.

  1. Alekaz

    Alekaz

    Joined:
    Dec 6, 2020
    Posts:
    20
    Hello I don’t understand too much in my script I think I put everything well there is no error in my console and in game it does not move horizontally, Did you have a solution please?
     

    Attached Files:

  2. VishwasGagrani

    VishwasGagrani

    Joined:
    May 12, 2018
    Posts:
    81
    You are assigning target velocity with the y component of rb.velocity ? If it is zero then the new targetVelocity too will be zero.

    Also don't share code's screenshot. Paste the code here in proper code-tags. It's difficult to see it from screenshot.