How to move a simple 2d object

The simplest code in the world is not working.
The skull does not move.
Why?
Could you give me a solution?

Image:

That’s my simple code:

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

public class skullspeed : MonoBehaviour
{
    public int speed;
   
    void Update()
    {
        transform.Translate(Vector3.forward * speed * Time.deltaTime);
    }
}

I find the solution. The solution is use Vector2. Because is a 2d game and the Vector3 doesn"t work.

1 Like

Please help. I am making a game, and using simalar code and it keeps telling me I am missing a } but I can’t find it.
Heres the code:

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

public class MovementScript : MonoBehaviour
{
    public float speed = 15;
   
    // Start is called before the first frame update
    void Start()
    {
       
    }

    // Update is called once per frame
    void Update()
    {
        if(Input.GetKey(KeyCode.D))
        {
            transform.Translate(Vector2.Right * speed * Time.FixedDeltaTime);
        }
    }
}