search for the nearest destination

the situation is as follows - a path is searched, point A is looking for a path to point B, for this it calculates the initial direction, for example, point A is at the top left and point B is at the bottom right, respectively, the vector (1f, 0 -1f) is obtained. if this point is inaccessible (blocked by some obstacle), then you need to look for other directions, and of course it is better to look for the optimal ones, that is, in this situation, you need to turn 45 degrees from the current direction, then -45, then 90 and -90, etc. .d. tell me how to do this?
i tried like this

private Quaternion[] ArrayDirRot = new Quaternion[8]{
        Quaternion.Euler(0f, 0f, 0f),
        Quaternion.Euler(0f, 45f, 0f),
        Quaternion.Euler(0f, -45f, 0f),
        Quaternion.Euler(0f, 90f, 0f),
        Quaternion.Euler(0f, -90f, 0f),
        Quaternion.Euler(0f, 135f, 0f),
        Quaternion.Euler(0f, -135f, 0f),
        Quaternion.Euler(0f, 180f, 0f)
        };
Vector3 dir = new Vector(1f, 0 -1f);
for(int i = 0; i < ArrayDirRot.Length; ++i){
     dirRot = ArrayDirRot[i] * dir;
     searchPoint = pointStart + dirRot;

but it doesn’t work, I don’t even understand how it “rotate”…

This question is worded in a way which makes it very unclear.
Are you using a NavAgent? The calculate path function ?
How do you determine if a path is blocked by an obstacle?
Better to break this down into smaller pieces.

Yes, already by this moment there is some kind of movement, I don’t use navmesh, the search is carried out by a castsphere, at the moment I still don’t understand how to implement several branches of the passage, the search for a path goes in the shortest way, and if there is a dead end, then the next available direction is selected …

I’d advise you to use either the built in navagent functionality of unity or to implement your own A* pathfinding algorithm.
The problem your trying to solve has been tackled multiple times by a great deal of people.

yes, I understand that, now I’m solving this problem with the help of A *, only in this method I don’t like the fact that there are a lot of unnecessary movements, that is, the object is ahead and the waves (according to the A * method) in all directions and most likely this is a waste of time .
I’m thinking of doing something like a rat looking for cheese in a maze, if you know what I mean…