Check whether something is inside a cone of raycasts

Here’s what I have:


I’m wondering how I would check if an object is inside of the cone?

Does it have to be raycasts? It will be easier to just use a cone shaped collider. There is a related discussion here:

an even better solution - for some circumstances, e.g. if the list of possible objects to check is quite small and known in advance - is to check if the angle of your-transform-versus-targets-transform falls within a certain range, representing a cone. This can easily be done by calculating the arccos of the dot product between both transforms, or using Unity’s Vector3.angle (Unity - Scripting API: Vector3.Angle). When the angle is low enough to fit in a cone, you can do a single raycast to the object to figure out if it is effectively line-of-sight visible from the first transform’s point. (to make sure there’s nothing in the way, blocking the direct view of the target…e.g. a wall.)
I use this technique to check if enemies are within a sniper’s rifle scope view, and that works nicely. I know upfront which enemies to check for (since I have less than some 50 enemies in one scene), and it keeps the calculations very cheap.