Getting no suitable method to override? But cant figure out why

Ive tried removing the parametres, AND the sceneManager, yet still i get this error, which baffles me as the method is empty outside the base.Update(). Anyone who can give me pointers? Ive made the scenemanager a singleton class for experimentation purpose, not sure if that could have something to do with it? The scenemanger does contain an update method written below:

Where i get the error in my GameWorld:
protected override void Update(GameTime gameTime, MouseState mouse)
{
mySceneManager.Update(gameTime, mouse);

        base.Update(gameTime);
    }

The scenemangers update:

public static readonly SceneManager instance = new SceneManager();

public virtual void Update(GameTime gameTime, MouseState mouse)
    {
        switch (myScenes)
        {
            case MyScenes.MainMenu:
                myMenuScene.Update(gameTime, mouse);
                break;

            case MyScenes.Characters:
                myCharacterScene.Update(gameTime, mouse);
                break;

            case MyScenes.DesignPlaystyle:
                myTalentsScene.Update(gameTime, mouse);
                break;

            case MyScenes.Playing:
                ourPlayer.Update(gameTime);
                //testFireball.Update(gameTime);
                break;

            case MyScenes.Talents:
                //MouseState mouse = new MouseState();
                myTalentsScene.Update(gameTime, mouse);
                break;
        }

        base.Update(gameTime);
    }

What error are you getting?

Litterally just this “GameWorld.Update(GameTime, MouseState)’: no suitable method found to override” and ive had it before, it should be a fairly simple error to correct, but what usually causes is doesnt seem to be the case this time.

Ah your code isn’t displaying in a code block on the post.

What is GameWorld inheriting from, anything?

Yeah from the monogame “Game” classs which is default for the game1/gameworld class

If you remove MouseState from GameWorld.Update does it work if the only parameter is GameTime?

No, i even tried removing EVERYTHING from my GameWorld.Update even its parametres only keeping the Update() and teh base.Update(). Which makes it really hard to locate the problem as it seems to be something with my GameWorld i would guess and not the classes used by it, or am i missing something? :confused:

So are these true in your file.

public class GameWorld : Game

protected override void Update(GameTime gameTime)

1 Like

Here is my full GameWorld class, but yeah except i got a mousestate in my update aswell. However ive trieed removing it and it changed nothing :confused:

public class GameWorld : Game
{
    // Makes this class a singleton class
    public static readonly GameWorld instance = new GameWorld();

    public enum ClassBtnToggled
    {
        None,
        Amazonian,
        Magus,
        ShadowSpawn,
        Blackguard,
        SenjuMonk,
        Deadeye,
        Gladiator,
        Templar,
    }
    public ClassBtnToggled classBtnToggled;

    GraphicsDeviceManager graphics;
    SpriteBatch spriteBatch;

    private SceneManager mySceneManager;

    public int screenWidth = 1360;
    public int screenHeight = 768;
    public string chosenClass;
    SpriteFont myFont;
    private const float messageDelay = 2;
    private float remainingDelay = messageDelay;
    private string designPlaystyleMessages;


    public GameWorld()
    {
        graphics = new GraphicsDeviceManager(this);
        Content.RootDirectory = "Content";

        graphics.PreferredBackBufferWidth = screenWidth;
        graphics.PreferredBackBufferHeight = screenHeight;
        graphics.ApplyChanges();
        IsMouseVisible = true;

    }

    protected override void Initialize()
    {
        mySceneManager = new SceneManager();

        classBtnToggled = ClassBtnToggled.None;

        base.Initialize();
    }


    protected override void LoadContent()
    {
        spriteBatch = new SpriteBatch(GraphicsDevice);
        mySceneManager.LoadContent();

        //myFont = Content.Load<SpriteFont>("myFont"); /*asdadasd*/

    }


    protected override void UnloadContent()
    {
    }

    protected override void Update(GameTime gameTime, MouseState mouse)
    {
        mySceneManager.Update(gameTime, mouse);

        base.Update(gameTime);
    }

    protected override void Draw(GameTime gameTime)
    {
        GraphicsDevice.Clear(Color.White);
        spriteBatch.Begin();

        mySceneManager.Draw(gameTime);

        spriteBatch.End();
        base.Draw(gameTime);
    }

Have you changed Program.cs to init that singleton o is it just running as normal?

You can’t just add arbitrary arguments to a method you’re overriding. As @lozzajp said, the signature of the Update method should be

protected override void Update(GameTime gameTime)

without the mousestate.

1 Like

Thanks guys got it to work yay! :smiley: