Try to recreate GD and am having some troubles

hello, i have what i think is a simmilar problem. i was watching an old tutorial on how to make geometry dash (obviously i expected some errors but i think ive fixed most of them) and i ran into a problem. I am trying to use:

// (enum that i need as string, time)
Invoke(currentGameMode.ToString(), 0)

to call my Cube() method, (none of the visual rotation interferes with hitboxes), which is:

//cube gamemode
void Cube()
{
detect if on ground
if(OnGround())
{
// detect if clicking
if(Input.GetMouseButton(0))
{
//jump
rb.velocity = Vector2.zero;
rb.AddForce(Vector2.up * 13.3162f, ForceMode2D.Impulse);
}

//simple visual jump rotation and snapping
Vector3 rotation = sprite.rotation.eulerAngles;
rotation.z = Mathf.Round(rotation.z / 90) * 90;
sprite.transform.rotation = Quaternion.Euler(rotation);
}
else
{

//simple visual rotation
sprite.Rotate(Vector3.back * 1.5f);
}
}

but when i play i get the message in the Console that is:

Trying to Invoke method: geometryDashMover.cube couldn’t be called.

Do you have any ways to fix this, and if you want all my code i can post the file.


my full code is (player movement):

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

public enum Speeds{slow = 0, normal = 1, fast = 2, faster = 3, fastest = 4}
public enum Gamemodes {cube = 0, ship = 1}

public class geometryDashMover : MonoBehaviour
{
    public Speeds currentSpeed;
    public Gamemodes currentGamemode;
    float[] speedValues = {8.6f, 10.4f, 12.96f, 15.6f, 19.27f};

    public Transform groundCheckTransform;
    public float groundCheckRadius;
    public LayerMask groundMask;
    public Transform sprite;

    Rigidbody2D rb;

    void Start()
    {
        rb = GetComponent<Rigidbody2D>();
    }

    void Update()
    {
        transform.position += Vector3.right * speedValues[(int)currentSpeed] * Time.deltaTime * 0.5f;

        Invoke(currentGamemode.ToString(), 0);
    }

    //cube gamemode
    void Cube()
    {
        //check if on ground
        if(OnGround())
        {
            //check if clicking
            if(Input.GetMouseButton(0))
            {
                rb.velocity = Vector2.zero;
                rb.AddForce(Vector2.up * 13.3162f, ForceMode2D.Impulse);
            }

            //simple jump rotation and locking
            Vector3 rotation = sprite.rotation.eulerAngles;
            rotation.z = Mathf.Round(rotation.z / 90) * 90;
            sprite.transform.rotation = Quaternion.Euler(rotation);
        }
        //fall rotation
        else
        {
            //simple rotation
            sprite.Rotate(Vector3.back * 1.5f);
        }
    }

    void Ship()
    {
        if(Input.GetMouseButton(0))
        {
            rb.gravityScale = -2;
        }
        else 
        {
            rb.gravityScale = 2;
        }
    }

    bool OnGround()
    {
        return Physics2D.OverlapBox(groundCheckTransform.position, Vector2.right * 1.1f + Vector2.up * groundCheckRadius, 0, groundMask);
    }

    public void ChangeThroughPortal(Gamemodes gamemode, Speeds speed, int state, int gravity)
    {
        switch(state)
        {
            case 0:
                currentSpeed = speed;
                break;
            case 1:
                currentGamemode = gamemode;
                break;
            case 2:
                rb.gravityScale = Mathf.Abs(rb.gravityScale) * (int)gravity;
                break;
        }
    }
}

and (portals):

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

public class portalScript : MonoBehaviour
{
    public Gamemodes gamemode;
    public Speeds speed;
    public bool gravity;
    public int state;

    void OnCollisionEnter2D(Collision2D collision)
    {
        try
        {
            geometryDashMover movement = collision.gameObject.GetComponent<geometryDashMover>();

            movement.ChangeThroughPortal(gamemode, speed, state, gravity ? 1 : -1);
        }
        catch { }
    }
}

good news! i fixed it, my enum had the wrong words in it.