AI Following Splines

I got many splines component in my scene, How can I tell my AIs which spline to use and which one to switch to?

Currently I’m storing all the splines in an array when they spawn and then checking the distance to each one to get the closest one, which is working but using way too much resources.