Create an object in screen space coordinate

Hi,

how can i create(intantiate) an object in screen space coordinate?for example i want create my object in 200,250 pixel position,like GUIs but i want have object and then move it in z vector.

so thanks.

You need to use Camera.ScreenToWorldPoint. You pass it a Vector3 value, where the X and Y values are the screen pixel coordinates, and the Z value is how far from the camera the resulting world point should be. For example:

// create an object at 250,250 pixel screen coords, at 20 units from camera
var screenPoint = Vector3 (250, 250, 20);
var worldPos = Camera.Main.ScreenToWorldPoint ( screenPoint );
var obj = Instantiate( sourceObj, worldPos, Quaternion.Identity );