Hello everyone
So I’m trying to make a public class which does some calculations which i’ll be using a lot, i’ve called that class HandyMethods.cs.
What I wanted to do, is to make a method which checks if there’s a collision between A and B (with the Physics.Raycast() function), and if there is, return a rayCastHit variable which I could then use in many other scripts. But what I want, is to have an easy way to check if this function didn’t find a collision (the Physics.Raycast returned the “false” value).
If I define my function like this
public RayCastHit CheckForCollisions(){}
it would only be able to return a RayCastHit type variable, right?
So how do I make the function so it can return both a “true” boolean value and a RayCastHit type variable?