Select object through Mini Map in world Space

I am making a mini map Using render texture to render my Over head cam to my screen and Drawing that texture using NGUI 3.9 every things is fine Apart from When i am Trying to click on My minimap and trying to destroy a object or Geting the point on my Game Floor which is on my World Space rendered by Main Camera Raycast is not reaching it some how i don’t know what i am doing wrong Edited: I am using Ngui is because whole Gui of my game is in Ngui so its my requierment

I have Edited my code to a new aproch by this i am able to cast a ray on to my floor but the position of my ray is not accurate

here is my code

public void TestWithTextureCoords()
Camera main = UICamera.mainCamera;

    Camera mapCam = transform.GetComponent<Camera>();

    Ray firstRay = main.ScreenPointToRay(Input.mousePosition);
    Debug.DrawLine(firstRay.origin, firstRay.direction);
    RaycastHit textHit;

    if (Physics.Raycast(firstRay, out textHit, main.farClipPlane))
        var hitPoint =  textHit.point;

        Ray scondRay =   mapCam.ViewportPointToRay(hitPoint);

        RaycastHit worldHit;
        if (Physics.Raycast(scondRay, out worldHit, mapCam.farClipPlane))
            Debug.DrawLine(scondRay.origin, worldHit.point,;

           Debug.Log(" world hit point " + worldHit.point);
            Debug.Log(, worldHit.transform);


Please look into it As soon as possible let me know a work around or how it is being done May be I am missing a small Think I have no idea about I have Tried different kind of approaches but all in vain help!

I’m pretty sure your minimap is beeing generated at runtime. So why not just add a component to each minimap object that contains a reference to the original GameObejct? You could then trigger whatever function whenever the map-object is hit by the ray.

Having that said, it seems as if you mixed something in your code. Why do you cast a ray in “global scope” BEFORE you do the raycast on the minimap? Wouldn’t the other way around be a much more fitting solution?