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 Character stopping alone

Discussion in 'Scripting' started by FeVergara, Jul 16, 2020.

  1. FeVergara

    FeVergara

    Joined:
    Jul 14, 2020
    Posts:
    8
    Hello, my character it's stopping alone when move.
    Started when update Unity.

    My script:
    using System.Collections;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Security.Cryptography;
    using UnityEngine;

    public class Jogador : MonoBehaviour
    {

    public Rigidbody2D rigidbody2d;
    public float move;
    private float direction;


    // Start is called before the first frame update
    void Start()
    {

    }

    // Update is called once per frame
    void Update()
    {

    direction = Input.GetAxisRaw("Horizontal");
    rigidbody2d.velocity = new Vector2(direction* move, rigidbody2d.velocity.y);

    }
    }

    Someone plz help me
     
  2. PraetorBlue

    PraetorBlue

    Joined:
    Dec 13, 2012
    Posts:
    7,735
    I don't understand what "stopping alone" means. What's the desired behavior?
     
  3. FeVergara

    FeVergara

    Joined:
    Jul 14, 2020
    Posts:
    8
    i want it to move normal(left and right 2D platform), but he stoping the move by their own (sorry my english)