Determining the Angle of a Vector3 from another Vector3 Origin

Hi I have a 3D space but I want to determine the angle of an object in degrees with regards to an object that acts as a center of origin. Kinda like a clock with one hand where I have an arrow pointing at an angle regarless of the z axis. Note that the Vector3.forward direction of both objects is always pointing away from the center as my object B moves. The question is how do I get the angle in degrees?

Here is a sample where it returns 45 wherein the angle may range from 0-359.

31167-untitled.png

You need a plane of reference or one other piece of information to make this work. If you want to make the XY plane the reference, you can do:

 dir = objectB.position - objectA.position;
 dir.z = 0.0;
 angle = Mathf.Atan(dir.y, dir.x) * Mathf.Rad2Deg;

This will get the angle of the vector projected on the XY plane with Vector3.right being 0 and the angles increasing as you rotate counter-clockwise.