is there a way i can create a function just in general that i can call for any gameobject i decide to use it with?
like, for example, if i want the player gameobject and every enemy gameobject to have a piece of code that checks their destination for a certain obstacle (let’s call it a landmine for argument’s sake) before moving, can i just write a “checkmines” script one time or do i need to paste a code that says something to the effect of
“if overlapsphere on target floor doesn’t return a mine, go ahead and step there”
in every type of enemy i make?
i have more general applications i’d prefer to use this for as well this just seemed like an easy example
thanks!