Moving box help

Ive been trying to make a 2d box move for 12 hours now, and it just never works, even when I follow tutorials. So I was wondering if any of you have a script you can put in the comments.

How did it not work ? What did you try ?how you want it to move?

How to report problems productively in the Unity3D forums:

http://plbm.com/?p=220

Help us to help you.

Also, please use code tags: Using code tags properly

When I put it into my character it wont give me the option to change speed or jump and wont let me move, I tried around 5 tutorials, just a simple move, jump, crouch,no sliding when moving though.

Hmm…put what? Maybe you could post the script via code tag

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Playermovement : MonoBehaviour
{

    public float speed;
    public float jump;

    private float move;
    private Rigidbody2D rb;
    // Start is called before the first frame update
    void Start()
    {
        rb = GetComponent<Rigidbody2D>();
    }

    // Update is called once per frame
    void Update()
    {
        move = Input.GetAxisRaw("Horizontal");

      rb.velocity = new Vector2(move * speed, rb.velocity.y);
    }
}

Try this
Everything you want is in it

Looks good from a code standpoint.

I recommend liberally sprinkling Debug.Log() statements through your code to display information in realtime.

Doing this should help you answer these types of questions:

  • is this code even running? which parts are running? how often does it run?
  • what are the values of the variables involved? Are they initialized?

Knowing this information will help you reason about the behavior you are seeing.

thanks to both of you Ill try it