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