How do i reference self to be a GameObject, not a Object? (or what i didn't understand right)

Here’s my problem:

Script in non-Rigidbody2D object:

protected Rigidbody2D current;
    public void MyFunction (bool check, GameObject obj) {
    current = obj.GetComponent<Rigidbody2D>(); //error CS1061 here
      if (check) {
        current.position = Vector2;
      } else {
     current.position = Vector2.zero;
  }
}

Script on Rigidbody2D object:

 public Non-Rigidbody2DScript script;
    
    void FixedUpdate(){
      script .MyFunction(true, this);
    }

As i saw using Debug.Log, the this in the Object referencing a Object type, not a GameObject… then the question:
How i reference in function call in the Rb2D object itself with the GameObject reference? (or what i’m doing wrong in all this)

Hello there,

“this” actually refers to the script (or instance, rather), NOT the GameObject.

If you wanted to pass the GameObject in your MyFunction() call, then you would do this instead:

script .MyFunction(true, gameObject);

Hope that helps!

Cheers,

~LegendBacon