detecting if a gameobject is touching another gameobject (help please)

HI i would like to preface this with i have spent the last three or so hours reading forums and stuff and reading documentation etc on how to do this but the problem is that i am stupid (wow) and all the examples are like not applicable sort of (i am probably just dumb sorry) (also if this is the wrong place to post this i very much apologise) (sorry)

heres sort of what i am trying to do (sorry it is explained poorly i am bad with words)

//(declaration i have above vvv)
        //public bool IsTouching(Collider2D collider);
        //^additionally i have ladders and the player guy set as public gameobjects (set to the right things in editor)
        //^also thats literally all the api said you have to declare but it keeps saying its aids
        ////'(IsTouching(Collider2D)' must declare a body because it is not marked abstract, extern, or partial
        //ladders has a tilemapcollider2d acting as a trigger
        //playerguy(thats a placeholdername shh) has a rigidbody2d
        //i want: when the player guy touches the ladders to do a thing but i do not know how to do the silly collider thing because i have a negative iq
        //this script isnt attached to either of them its attached to a diffferent one that controls everything (will be easier for me later)
        //i would very rather not make a separate script just for this (sucks)(clunky)(cannot keep track of it im dyslexic)
        //the how i think it should probably work (doesnt) (i am stupid)
        if (playerguy.istouching(ladders))
        {
            //do the do the thing
        }

        //please help please and thanks (mostly a syntax issue i think(?)) (i cant read)

most of the examples and whatnot seem to imply that i would have to make a separate script, attach it to the ladders object, then id have to mess around to get what i need in this big script and that feels really gross to me so i feel like there is probably a way to do it in one script? I think this because i thought i had to make a separate script for everything but then i realised that you can public gameobject thing and then get the component and its a million times cleaner so i dont! know why! this is so much different!

tldr;

how to
if (obj1 is touch obj2)

i am doing my best i swear : ( please help <3

Look into colliders and rigidbodies.
You can do 2 things:

  1. Use OnCollisionEnter/OnCollisionExit to manage the collisions and check tags or OnCollisionStay (same for triggers)
  2. Use a Physics.OverlapSphere (or capsule) at the desired position and check collisions.
  3. Do a Physics.Raycast downwards/forwards etc if you wanna see of something is there

i initially did look into those but i think the problem is that the oncollsion stuff is in the form of a method
so im not sure how to like
this is what the api has for it

using UnityEngine;

public class Example : MonoBehaviour
{
    float rechargeRate = 10.0f;
    float batteryLevel;

    void OnCollisionStay2D(Collision2D collision)
    {
        if (collision.gameObject.tag == "RechargePoint")
        {
            batteryLevel = Mathf.Min(batteryLevel + rechargeRate * Time.deltaTime, 100.0f);
        }
    }
}

which makes it look like id have to make another script to attach it to the first object
but i would want to like

using UnityEngine;

public class Example : MonoBehaviour
{
    void objectone.OnCollisionStay2D(Collision2D collision)
    {
        if (collision.gameObject.tag == "obj2")
        {
            stuff
        }
    }
}

edit–
I looked a lot more into them and i am now stuck on this portion-

void OnCollisionStay2D(ladders.Collision2D collision)
    {
        if (collision.gameObject.tag == "player")
        {
            isOnLadder = true;
        }
    }

when i remove the ladders. it compiles, but it doesnt do anything. with the ladders., i get the error ‘The type or namespace name ‘ladders’ could not be found (are you missing a using directive or an assembly reference?)’ even though i have a public GameObject ladders; in the right place

i feel like it is probably a syntax thing which sucks because i cannot read. please help xoxo

I’m having a similar issue, but I want to know if I can see if square collider is touch something but no capsule collider

nm i found an answer