How can define touch areas at fly based on backgound color?


I am trying to define touch areas in function of backgrounds shapes.
This areas are painted like meshes in an transparent background.
How could get it working?.

Thanks a lot!.

If i understand your question, what yo uneed to do is this:

  1. Get the mosue position on button click
  2. Use Unity - Scripting API: Camera.ScreenPointToRay to get a ray into your scene
  3. Do a ray cast to find the world position of the collision of that ray with your map
  4. Use Unity - Scripting API: Transform.InverseTransformPoint with the map’s transform to convert the point to object local coordinates
  5. Use the UV coordinates to do a reverse lookup to your texture