Override method not working

hi so I have a script that the override method dose not override one of my Methods

public override void OnInteract(){

        Dialog.instance.Show ("Hi don't forget The chest.");
       
    }

I have another OnInteract method in another script do I need a virtual in that method

Yes.

You said in another script, so I just wanted to be sure you are correctly inheriting the class.

    class BaseClass
    {
        //other logic
        public virtual void OnInteract()
        {
            Dialog.instance.Show("Something");
        }
    }

    class SecondClass : BaseClass
    {
        public override void OnInteract()
        {
            base.OnInteract();
        }
    }
1 Like