ray transform.position goes wrong

ok why does first code not working properly?

Debug.DrawRay (transform.position, new Vector3(transform.position.x + 10, transform.position.y, transform.position.z + 0), Color.red);
Debug.DrawRay (transform.position, new Vector3(transform.position.x + -10, transform.position.y, transform.position.z + 0), Color.red);
Debug.DrawRay (transform.position, new Vector3(transform.position.x + 0, transform.position.y, transform.position.z + 10), Color.red);
Debug.DrawRay (transform.position, new Vector3(transform.position.x + 0, transform.position.y, transform.position.z + -10), Color.red);

this code gives 4 lines in 4 directions correctly

Debug.DrawRay (transform.position, transform.forward*10, Color.red);
Debug.DrawRay (transform.position, transform.forward*-10, Color.red);
Debug.DrawRay (transform.position, transform.right*10, Color.red);
Debug.DrawRay (transform.position, transform.right*-10, Color.red);

why does first code go in 4 direction forward like:

\|/

I don’t get it…

The second parameter is a direction. It is assumed that (0,0,0) is the basis of the vector, so your rays are the direction those positions are from the origin. Try this instead:

Debug.DrawRay (transform.position, new Vector3(10, 0,  0), Color.red);
Debug.DrawRay (transform.position, new Vector3(-10,0,  0), Color.red);
Debug.DrawRay (transform.position, new Vector3(0,  0,  10), Color.red);
Debug.DrawRay (transform.position, new Vector3(0,  0, -10), Color.red);

For example now you have a vector that is +10 on the x axis away from the point specificed as the first parameter. Note that the other four DrawRays() are not the same as these (now edited) four. These four will align with the world axes. The other four will align with the rotation of the block.