Get the base class from the derived class

Hello, I am having problems with this all day, I found something like this: c# - How to Get Base Class Instance from a Derived Class - Stack Overflow but did not help.
The problem is:

I have the class “Character” and class “Player” is a derived class from character.

I need to pass the “Character” as class as parameters to a method ( I need to pass it inside Player class). How can i get this info?
I already tried GetComponent(); I already tried to make the Character class return itself, I already tried the getType().BaseType(), but it only returns the base type (and i need the class, not type).

Thank you.

It seems you haven’t understood what inheritance actually means, If the Player class is derived from Character, then a Player instance is also a Character. Just like a particular person is a human and every human is a living being.

If your Character class is derived from MonoBehaviour the inheritance chain is even longer.

    System.Object
         /|\
          |
  UnityEngine.Object
         /|\
          |
      Component
         /|\
          |
      Behaviour
         /|\
          |
    MonoBehaviour
         /|\
          |
      Character
         /|\
          |
        Player

A Player instance is also a Character and is also a MonoBehaviour and is also a Component. Treating a Player instance as one of it’s base classes is called “upcasting”. Upcasting happens automatically.

So for example if a method expects a Character as parameter you can also pass a Player instance as a Player is also a Character.

Best example is Unity’s Destroy method. It takes a UnityEngine.Object as parameter, that’s why you can pass any class that is derived from that Object class.

If you want to use access the object instance of a class itself you just have to use “this”.