how to make clickable object

hi all,
in my game i want to make certain things click-able in my game , a pop up will come after clicking in the object and give detailed information .

how can i do this.
help me people.

Use a raycast from your mouse position and if that raycast collides with an object show the necessary GUI information.

what is this raycast

The docs are your friend! :slight_smile:

Physics.Raycast

And to preempt the next question, you can convert a mouse click position to a world position (from which you cast the ray above) using the Camera class, notably the Camera’s ScreenToWorldPoint method.

So:

  1. Get mouse click position
  2. Convert mouse click position to a world position on the near clipping plane
  3. Cast a ray from that position into the world and see if it collides with anything, object is thus “clickable” (or for objects not of interest you simply ignore the collision, filter it out, etc.).

Rock on!

Hi

I am not clear with above steps.
how to make a object click-able??

Help me out please.
Thanku

The raycast method is described with a code sample in this thread.