Hi, I'm a noob, so please be gentle...

I have a plane and want to convert the Screen Mouse Position to the position on that plane. (for some kind of strategy game) What's the best (most efficient) way to do this? Raycasting or using ScreenToWorldPoint? Either way I can't get it to work. Does anyone have some example code?

Thanks for your help!

You would likely want to raycast. You could use ScreenToWorldPoint and build your own ray or you could just use raycast with ScreenPointToRay to save yourself the effort.

How you choose to raycast is up to you. You can use a physics raycast which requires you have a collider on the object you are casting against and that it not be on the ignoreRaycast layer or you could raycast against the collider explicitly or you could raycast against the plane itself which is computationally somewhat cheaper, but only negligibly so.

//Using physics
var hit : RaycastHit;
if(Physics.Raycast(mainCamera.ScreenPointToRay(Input.mousePosition), hit))
    //we hit

//Raycast against a specific collider (plane is a gameObject or Transform)
if(plane.collider.Raycast(mainCamera.ScreenPointToRay(Input.mousePosition), hit))
    //we hit

//hit.Point would be the point in the world where the ray hit.

//Raycast against the plane itself (plane is a Plane)
var enter : float;
if(plane.Raycast(mainCamera.ScreenPointToRay(Input.mousePosition)))
    //we hit

//enter gives us the distance along the ray, so 
//mainCamera.ScreenPointToRay(Input.mousePosition).getPoint(enter);
//would give us the point in the world where the ray hit.

You say you want the point on the plane. For most purposes, having the world position is enough. If you actually need to know a point relative to the plane, then, assuming that your plane's transform pivot is properly centered and aligned, you would convert to object space and get the point relative to the plane.

//This is the position relative to the center of the plane.
//We should only need to care about the x and y coordinates as z should be 0.
var localPoint : Vector3 = plane.transform.InverseTransformPoint(hit.point);

Do as you like with that. If you need coordinates in some other system relative to the plane's scale or something, the calculation is straightforward.

I personally used this C# code based on the code from Scott Kovacs:

Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
RaycastHit hit;
// Casts the ray and get the first game object hit
Physics.Raycast(ray, out hit);
Debug.Log("This hit at " + hit.point );

I already knew that there was a hit, so my code doesn’t check if there is no hit. If there is no hit, this code returns (0.0, 0.0, 0.0).

This give the true world position. Just create a Javascript file with this code in it and add it to the your main camera.

function Update(){
	if(Input.GetMouseButtonDown(0)){
		var hit: RaycastHit;
		var ray = Camera.main.ScreenPointToRay(Input.mousePosition);
		if(Physics.Raycast(ray, hit)){
			Debug.Log('Hit point: ' + hit.point);
		}
	}
}