I need help adding collision to my walking script

I’m currently trying to make an IOS app with unity, as you can see in the picture I have a character, boxes and two buttons

I have made a script that lets my character move when the buttons are pressed,

using UnityEngine;
using System.Collections;
using UnityEngine.UI;
using UnityEngine.EventSystems;

public class Movement : MonoBehaviour
{
    public Button storeButtonRight;
    public Button storeButtonLeft;
    public float speed = 100f;
    public Transform player;

    void OnEnable()
    {
        // storeButton.onClick.AddListener(MyFunction);//adds a listener for when you click the button
        storeButtonRight.onClick.AddListener(() => moveCharacter(new Vector2(1, 0f)));
        storeButtonLeft.onClick.AddListener(() => moveCharacter(new Vector2(-1, 0f)));
    }

    void moveCharacter(Vector2 direction)
    {
      player.Translate(direction * speed * Time.deltaTime);
    }
}

This works and all, but my main problem is that my Collision won’t work, I added collision 2d objects to all the objects, but the player still walks right through them any help please?

6182960--677324--Screen Shot 2020-08-08 at 10.39.41 AM.png

You cannot modify the position of the object via the Transform component directly if you need it to interact with physics colliders. For that, you must use a Rigidbody/Rigidbody2D component to move the object.

See:

Thanks It really helped